当前,我正在尝试使用 Cognito Aws服务为我的Web应用程序实现社交登录。但是我不想将用户重定向到用于社交登录的Cognito 托管用户界面。
因此,我将react-google-login用作Google登录名,并且也获得了回调访问令牌
<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);
});
}
上面的代码提供了Cognito会话值,但是并没有在用户池中创建用户。
我进行了很多搜索,但未找到任何解决方案。我已经在下面的链接中提到了它,这是我的问题。基本上,我不想为SocialLogin使用托管的UI。
预先感谢