javascript - AWS 认知 : getting "Please provide a valid public provider" with google

标签 javascript amazon-web-services oauth google-plus amazon-cognito

当我尝试像这样设置 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/

相关文章:

javascript - 使用变量与获取输入值时 substr() 的不同结果

javascript - 如何使我的 .css 和 .js 文件与 Android 上的 WebView 中加载的 html 代码一起使用

amazon-web-services - Cloud Formation 模板将入口规则添加到现有安全组

Facebook OAuth 登录停止工作

Android Oauth随机返回认证错误 "nonce_used"

angular - 使用 angular 2+ 的社交登录时,信息以何种方式在组件之间传递?

javascript - 即使有合适的加载器,Webpack 也无法处理 JSX

javascript - 初学者 javascript - 显示有限数量的查询并在底部添加加载

amazon-web-services - AWS IAM 策略 elasticbeanstalk :DescribeEnvironmentHealth

sql - 使用 SES 发送个性化的每周摘要电子邮件?