How to add google sign in aws cognito in node js backend.

0

I'm using @aws-sdk/client-cognito-identity-provider in my node js express application.

I've able to implement login/signup using email/password and getting AcesssToken and RefreshToken and wanted to something same with google sign in. So I've able to complete fronted part of getting idToken from google auth.

so I would like to know how can I add google sign in my cognito and get AcessToken, RefreshToken since I can't able to find any documentation or articles about this.

Any help will be appreciated!

asked a year ago1312 views
1 Answer
0

Hi,

The following Knowledge Center post describes step by step how to configure Google as a federated identity provider (IdP) in an Amazon Cognito user pool.

Having said that, if you want authenticate an end user from the frontend against a third party (Google here), you may take a look at Oauth2 Authorization code grant flow, since the credentials should not go through your backend server.

profile picture
EXPERT
answered a year ago
  • I also need Access and Refresh Token! from cognito in my backend node js

  • the link you provided is using hosted ui and I want my custom frontend (next js)

  • I've used @react-oauth/google in my frontend next js which return me a idToken I'm sending that to backend (node js express) where I want to use this token to auth or add to aws cognito. how can I do this?

  • Sorry, I may not have understood you correctly. Could you give me more information about your use case? Are you trying to log in a user or a machine?

    The Oauth2 Authorization code grant flow will provide you an access, id and refresh token, but Cognito Hosted UI is required.

  • does my user needs to go to the hosted UI to sign in through Google or other social providers.

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