Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140762

Google SignIn In Cognito Using Custom Login Form

$
0
0

Currently, I am trying to implement Social Login for my web Application using Cognito Aws Service. But I don't want to redirect the user to Cognito Hosted UI for Social Login.

So I use react-google-login for the Google Login and I am getting the callback access token too

<GoogleLogin
   clientId="xxxxxxxxxxxxxx.apps.googleusercontent.com"
   buttonText="Login"
   onSuccess={this.responseGoogle}
   onFailure={this.responseGoogleFailure}
   cookiePolicy={'single_host_origin'}
/>


responseGoogle = async (response) => {
  console.log("response..........", response);
  const user = {
    name: response.profileObj.name,
    email: response.profileObj.email
  };

  let expires_at = 3600 * 1000 + new Date().getTime()

  Auth.federatedSignIn('google', { token: response.tokenId, expires_at }, user).then(credentials => {
     console.log(credentials);
  });
}

The above code gives the Cognito session values but that doesn't create a user in the user pool.

I have search a lot but didn't find any solutions. I have already referred this below links it refers to my problem. Basically I don't want to use hosted UI for the SocialLogin.

Thank In advance

https://github.com/aws-amplify/amplify-js/issues/1316

https://github.com/aws-amplify/amplify-js/issues/3875


Viewing all articles
Browse latest Browse all 140762

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>