当我尝试像这样设置 google 访问 token 时,收到 400“请提供有效的公共(public)提供商”:
AWS.config.update(
{
region: window.region,
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: window.identityPoolId,
Logins:
{
'accounts.google.com': gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().id_token
}
})
});
Cognito 的初始化如下:
window.region = Pointer_stringify(region);
window.identityPoolId = 'us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxx';
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = '/aws-sdk.min.js';
po.onload = function()
{
var po2 = document.createElement('script');
po2.type = 'text/javascript';
po2.async = true;
po2.src = '/amazon-cognito.min.js';
po2.onload = function()
{
AWS.config.region = window.region; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: window.identityPoolId,
});
}
var s2 = document.getElementsByTagName('script')[0];
s2.parentNode.insertBefore(po2, s2);
}
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
我已将 google 客户端 ID 添加到身份验证提供商的 Google+ 选项卡,并将 account.google.com 添加到 OpenID 选项卡。 这只发生在 Google 上,它适用于 Facebook。
最佳答案
问题是我的身份池指向已删除的用户池。
关于javascript - AWS 认知 : getting "Please provide a valid public provider" with google,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36846966/