question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native - Apple Sign In

See original GitHub issue

I followed the doc to add Sign in with Google, Facebook and Apple from here: https://docs.amplify.aws/lib/auth/social/q/platform/js

Google and Facebook work perfectly fine but I couldn’t make Apple work after a whole day debugging.

Here’s some screenshots of the flow: Screen Shot 2020-08-24 at 5 12 21 PM Screen Shot 2020-08-24 at 5 12 43 PM Screen Shot 2020-08-24 at 5 20 10 PM

Here’s my logs from the Hub

[Mon Aug 24 2020 17:20:03.980]  LOG      Hub.auth {"payload": {"data": {"url": "setmatch://?error_description=SignInWithApple+Error+-+400+invalid_client&state=wrBob3s5zqoty4YDYInEC9NL5wQnQNuK&error=invalid_request"}, "event": "parsingCallbackUrl", "message": "The callback url is being parsed"}}
[Mon Aug 24 2020 17:20:03.981]  ERROR    [ERROR] 20:03.971 OAuth - Error handling auth response. [Error: SignInWithApple+Error+-+400+invalid_client]
[Mon Aug 24 2020 17:20:04.700]  LOG      Hub.auth {"payload": {"data": [Error: SignInWithApple+Error+-+400+invalid_client], "event": "signIn_failure", "message": "The OAuth response flow failed"}}
[Mon Aug 24 2020 17:20:04.900]  LOG      signIn_failure
[Mon Aug 24 2020 17:20:04.100]  LOG      Hub.auth {"payload": {"data": [Error: SignInWithApple+Error+-+400+invalid_client], "event": "cognitoHostedUI_failure", "message": "A failure occurred when returning to the Cognito Hosted UI"}}
[Mon Aug 24 2020 17:20:04.110]  LOG      Hub.auth {"payload": {"data": [Error: SignInWithApple+Error+-+400+invalid_client], "event": "customState_failure", "message": "A failure occurred when returning state"}}

aws-exports.js

const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_cognito_identity_pool_id": "us-east-1:xxxxxx,
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": "us-east-1_xxxxxxx",
    "aws_user_pools_web_client_id": "xxxxxx",
    "oauth": {
        "domain": "setmatch-dev.auth.us-east-1.amazoncognito.com",
        "scope": [
            "phone",
            "email",
            "openid",
            "profile",
            "aws.cognito.signin.user.admin"
        ],
        "redirectSignIn": "setmatch://",
        "redirectSignOut": "setmatch://",
        "responseType": "code"
    },
    "federationTarget": "COGNITO_USER_POOLS",
    "aws_appsync_graphqlEndpoint": "https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql",
    "aws_appsync_region": "us-east-1",
    "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
    "aws_appsync_apiKey": "xxxxxx",
    "aws_user_files_s3_bucket": "xxxxxx",
    "aws_user_files_s3_bucket_region": "us-east-1",
    "aws_mobile_analytics_app_id": "xxxxxx",
    "aws_mobile_analytics_app_region": "us-east-1"
};

Here’s some Cognito screenshots image image image

Here’s some Apple screenshots image image image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
sreggcommented, Aug 25, 2020

Alright. After another afternoon debugging this with the amazing help of @amhinson, I finally made it working. It basically was something like this: Here’s the steps I did (not sure which one helped):

  • I added the Sign in with Apple capability in my project in Xcode (pretty sure that’s only needed if you use the iOS SDK, but doesn’t hurt)
  • I deleted the user group created in User Pool > General settings > Users and groups > Groups > us-east-xxx_SignInWithApple
  • I disabled the Apple IDP in Federation > Identity providers > Sign in with Apple
  • I recreated that IDP (same sid, team id, key id, key file, and scopes email+name)
  • Enabled it again in App integrations > App client settings
  • Set up the attributes mapping again in Federation > Attribute mapping > Apple (email is unchecked by default)
  • Removed the app in my https://appleid.apple.com settings under Security > APPS & WEBSITES Hope this helps anyone who’s seeing this invalid_client error
2reactions
rapgithubcommented, Jun 16, 2021

in my experience since apple is making mandatory using “sign in with apple” in your project like a mobile app if you use other socials like Facebook or google, nothings seems to solve the issue that amplify with cognito using federatedSignIn with apple sign in does not work at all! I have spent days testing everything and still not having any solution! Please amplify put a clear working sample of using federatedSignIn with signInwithApple because it seems it is not working and only Facebook and google socials works fine! thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub - invertase/react-native-apple-authentication
A well typed React Native library providing support for Apple Authentication on iOS and Android, including support for all AppleButton variants.
Read more >
React Native: Sign in with Apple - Ross Bulat - Medium
Go to your Keys list and add a new key for Sign in with Apple. Add your (Primary) App ID to the key...
Read more >
How to add Apple authentication to your React Native app
Install the required npm packages from the terminal. · Run the command to install pods in your project in the terminal. · In...
Read more >
react-native-apple-authentication - npm
react -native native module for Apple Login. Latest version: 2.0.0, last published: 2 years ago.
Read more >
How to “Sign in with Apple” on React Native - Level Up Coding
Give it a name; Check “Sign in with Apple”; Configure “Sign in with Apple”, select your App ID; Register the key; Download it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found