Advice on Identifying Issue with Facebook login with Amplify/Cognito

0

Hi,

We're experiencing trouble using Cognito with Facebook login in the app we are developing using Amplify on iOS (Swift). We are using Apple and Google sign-in without issue, but when we use Facebook authentication, we receive an error message without much detail:

HubPayload(eventName: "Auth.socialWebUISignInAPI", context: nil, data: Optional(Swift.Result<Amplify.AuthSignInResult, Amplify.AuthError>.failure(AuthError: invalid_request
Recovery suggestion: Received an error message from the service)))

We are not sure where the issue is - whether it's something with our Amplify or Cognito setup, or with our app's Facebook Developer configuration. Any advice on isolating where the issue is and next steps would be greatly appreciated.

We've validated the app ID and secret.

We are using Amplify 2.11.5 in an iOS app, written in Swift. The snippet of the code calling the login:

    let result = try await Amplify.Auth.signInWithWebUI(for: .facebook, presentationAnchor: w!)
    if (result.isSignedIn) {
      print("Signed in")
    } else {
      print("Sign in failure ")
    }

Any pointers would be greatly appreciated.

Thank you,

Will

1 Answer
0

Hello,

Thank you for sharing details. The amplify code which you are using do not have any issues. This error usually occurs if there are any issues with Cognito/IDP configuration or how the request is being made with amplify using values from amplifyconfiguration.json file.

To narrow down the issue, we can try logging in using Cognito Hosted UI to see if we are seeing any errors in the url. If your appclient only contains callbackurl to your app(For Ex: myapp://), we might face errors. Hence if possible, can you add any web url(For Ex: https://www.google.com) as callback in appclient and test it.

Cognito -> App Integrations -> app client -> View Hosted UI

If you are seeing error when testing with Hosted UI, then the error might be with Cognito/IDP configuration. To investigate the issue further and check your resource configurations, we request you to raise a Support case with Cognito team along with HAR file and UserPool ID.

However if in case, if you are not seeing any error with hosted UI, the issue might be with request being sent from Amplify. To troubleshoot this further, we request you to raise a Support case with Amplify team with with amplifyconfiguration.json file and userpool ID.

Thank you

AWS
SUPPORT ENGINEER
answered 10 months ago
  • Thank you, I did try the hosted UI and ran into the same issue. I will submit a support case with the HAR file. I appreciate your guidance!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions