问题描述
我正在尝试与Microsoft签署。该网站已具有Google登录名。遵循AWS文档中的以下代码,它可以成功运行:
const getAWSCredentials = async googleUser => {
const { id_token,expires_at } = googleUser.getAuthResponse();
const profile = googleUser.getBasicProfile();
const user = { email: profile.getEmail(),name: profile.getName()};
await Auth.federatedSignIn('google',{ token: id_token,expires_at },user);
};
function MicrosoftButton() {
const authHandler = (err,data) => {
if (!err && data) {
const user = data.authResponseWithAccesstoken.account;
const token = {
token: data.authResponseWithAccesstoken.accesstoken,expires_at: data.authResponseWithAccesstoken.expiresOn,};
(async () => {
const result = await Auth.federatedSignIn(
'microsoft',token,user,);
console.log(result);
})();
}
};
return (
<MicrosoftLogin clientId={YOUR_CLIENT_ID} authCallback={authHandler} />
);
}
但是我收到一个错误消息:“ 未处理的拒绝(NotAuthorizedException):无效的登录令牌。颁发者与providerName不匹配”。我在做什么错了?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)