Home > Mobile >  Getting error "invalid_request: Invalid web redirect url" when using Apple ID sign-in with
Getting error "invalid_request: Invalid web redirect url" when using Apple ID sign-in with

Time:12-03

The issue

We have a development copy of a website and a production copy. We also have a Firebase project for dev and another for production.

In both, sign-in with Google and email link options work. But for Apple sign-in, it only works in development.

I'm honestly stumped about what the issue could be. The error in the Apple sign-in popup provides no other clue. It just thinks the redirect URL for the Firebase project is wrong, even after all of the checking I've done.

Any suggestions will be greatly appreciated.

What we've tried

In Apple Developer account > "Certificates, Identifiers, & Profiles"

  • A Service Identifier is configured for web
    • Named like com.example.web, but for our company
    • Set up for "Sign in with Apple"
    • Primary app ID is our actual app we're actively developing
    • Under "Website URLs"
      • Necessary domains and subdomains are listed - without an https:// prefix
      • Necessary redirect URLs are listed - with an https:// prefix
    • We've generated a private key to use in Firebase
      • I've tried using the one I know works in both Firebase projects, but I've also tried using a different one

In Firebase > Authentication > Sign-in method > Apple

  • This method is enabled
  • The Services ID is correct in both cases
    • We're using the same one for both Firebase projects (not sure if we need separate ones for each)
  • The Apple team ID is correct
  • The Key ID is correct (I've checked this several times, when using the same key for both and when using a different key for production)
  • The correct key is used for the selected Key ID
  • The handler URL on this page matches what was added to the Service Identifier created earlier

After all this, I also tried creating a completely different Service Identifier to use for production. Instead of the invalid redirect URL issue, I got an "invalid client" error, so I went back to the identifier and key we were originally using.

Solutions found elsewhere

There were a few that came up on the Apple forums and a handful here on StackOverflow.

Most said to make sure the redirect URL was correct and had the HTTPS prefix, and that the domains were added without a prefix. I've checked these over and over and there's no mistake here.

I also tried deleting and recreating the indentifier as mentioned in this thread. Apple sign-in still works with the development site and development Firebase project, but not with the production site and Firebase project.

CodePudding user response:

Issue resolved.

When we first encountered this issue, the configuration was incomplete. I think after we finished configuration in our Apple account, it may have taken time to propagate since we were still seeing the error by the time I posted this question.

But it's working correctly now.

  • Related