Home > Blockchain >  AWS Cognito User Pool Social providers for auth/log in
AWS Cognito User Pool Social providers for auth/log in

Time:10-06

Hi guys, I have a user auth/sign-in problem:

  • The project is in react-native
  • Backend is on AWS, therefore we are using Cognito user pool identity pools.
  • Our app should authenticate users only via Google or Apple -> meaning no local/AWS username/password.
  • After the authentication of the user, I want to get his/hers token ID in order to access our Gateway API secured with the authorizer expecting this id token.

What I have done:

  1. Created and set up apple/google dev console and got google app id and apple team id, key & identifier.
  2. Created Cognito user pool identity pool and added id from step one

Now, I want to make it work on FE. I want to have custom buttons that have will have on press functions that invoke sign-in process. Also I would like to skip generated Cognito hosted UI for sign-in and go directly to the given provider (I think via Auth.federatedSignIn({customProvider: "provider"}). Can this be embedded in the app? Is somewhere on GIT an example? Can someone elaborate more on this, please? I kidn of need OAuth flow with AWS functionality minus AWS generated UI...

I couldn't find an exact answer anywhere. If there will be any unclear parts, I will elaborate more. Thank in advance!

CodePudding user response:

When navigating to the authorization endpoint you can pass an additional parameter in the query string identity_provider as documented here.

This instantly redirects the user to the IDPs sign-in and consent page without showing the hosted UI.

CodePudding user response:

I have found the by to bypass the hosted and generated Cognito UI. Just inspect the element (login button) and copy the link. Works like a charm!

  • Related