Hello fellow developers,
My team has been running into a persistent INVALID_CLIENT error while trying to implement Sign In With Apple JS in our Nextjs app with signInWithPopup from firebase/auth. Here is the full error:
Error getting access token from https://appleid.apple.com, OAuth2 redirect uri is: https://[redacted]/__/auth/handler, response: OAuth2TokenResponse{params: error=invalid_client, httpMetadata: HttpMetadata{status=400, cachePolicy=NO_CACHE, cacheDurationJava=null, cacheImmutable=false, staleWhileRevalidate=null, filename=null, lastModified=null, retryAfter=null, crossOriginEmbedderPolicy=null, crossOriginOpenerPolicy=null, crossOriginResourcePolicy=null, permissionsPolicies=[], headers=HTTP/1.1 200 OK, contentSecurityPolicies=[], originTrials=[], reportToHeaders=[], varyHeaderNames=[], cookieList=[]}}
I've checked every thread on these forums and stackoverflow for solutions to this very common issue, and we tried them all. We made sure to verify that the Services ID, Apple Team ID, Key ID and Private key are all correctly used in the firebase console, we have regenerated our keys, all to no avail.
We also contacted Apple Support via the Development And Technical option with Certificates, Identifiers, and Provisioning Profiles topics, but they directed us to code-level support, which excludes 3rd Party libraries so this does not seem appropriate for us.
Does anyone have any idea of what might be wrong or suggestions for something we could try? We are able to get the pop up to open with an Apple login form, allow us to enter the credentials, but then when we hit continue the error occurs.
We are using firebase version ^10.4.0
Any help would be greatly appreciated and let me know if I need to provide any additional info. Thank you.
Please see the following technote for methods to troubleshoot this error:
TN3107: Resolving Sign in with Apple response errors
If the error continues to occur, please follow the steps outlined in the post below to gather logs:
Gathering required information for troubleshooting Sign in with Apple authorization and token requests
https://developer.apple.com/forums/thread/762831
Cheers,
Paris X Pinkney | WWDR | DTS Engineer