Invalid redirect_uri in Apple sign in

Hello, I'm trying to implement the Sign in with apple feature to our web login.

I configured the App ID and Service ID and added the return Url, but I'm getting the error message "invalid_request. Invalid redirect_uri."

here is my initilization code


AppleID.auth.init
({clientId : 'com.test',
scope : 'name',
redirectURI : 'https://test.com/auth/login'
usePopup : true
})

Replies

I´m getting the same error here! =/

Hi, 

Because your authorization began within your web application, you should use your Services ID (e.g., com.example.webapp) as the value of client_id. Additionally, you'll want to make sure your Return URLs are identical to the redirect_uri provided in your authorization and/or validation requests.

Please let me know if the information about does not resolve your issue(s).
I am getting same error, when trying to do Apple sign in through Azure.
I found the solution. When you create the ID, you are not allowed to set the domain with a http or https prefix. But you MUST set the redirect uri with the prefix as you have to do it the same way in your code. This is clearly not visible in the console. Also, when you create the ID without the prefix and you want to remove the redirect uri and add the correct one with the prefix, Apple removes the prefix silently and you will still run into the same error. So the solution is to delete the ID, and recreate it with a redirect uri with prefix. Took me only 2 hours to figure this out.
  • Thanks a lot for your comment. I had a typo I thought I fixed but it was still there. tl:dr : Just recreate your Service ID with the right config.

  • I had domain and redirect uris correct and it was not working. Recreating the service id solved this.

Add a Comment
@balintfarago is 100% right, you have to specify https as well with redirect URIs, also when fixing existing service id to add https with redirect uri if it doesn't work, delete the service id and create a new one with correct https redirect uri and it will work fine after that.

If anyone finds this post and is using Azure AD B2C for Oauth2/OIDC and you're getting the "Invalid request" "invalid web redirect uri" error, you need two redirect URLs that point to your Azure AD B2C tenant.

The redirect URI config is under the ServiceID configuration in developer.apple.com

https://yourorg.b2clogin.com//oauth2/authresp https://yourorg.b2clogin.com//oauth2/authresp

  • the forum scrubbed out a couple things ... one redirect URI needs to contain your tenant domain. e.g. yourorg.onmicrosoft.com the other should contain your tenant GUID.

    https://yourorg.b2clogin.com/yourorg.onmicrosoft.com/oauth2/authresp https://yourorg.b2clogin.com/00000000-0000-0000-0000-000000000000/oauth2/authresp

Add a Comment