AWS Cognito:使用 google 获取 "Please provide a valid public provider"
AWS Cognito: getting "Please provide a valid public provider" with google
当我尝试像这样设置 google 访问令牌时,我得到 400 "Please provide a valid public provider":
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+ 选项卡,并将 accounts.google.com 添加到 OpenID 选项卡。
这只发生在 Google,它适用于 Facebook。
您可能会看到此错误的原因之一是,如果您已将您的池配置为开发人员身份验证流,并且提供程序名称为 'accounts.google.com'。您能否检查池中自定义身份验证提供程序的 Cognito 控制台并确保它未设置为 'accounts.google.com'?
问题是我的身份池指向一个已删除的用户池。
当我尝试像这样设置 google 访问令牌时,我得到 400 "Please provide a valid public provider":
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+ 选项卡,并将 accounts.google.com 添加到 OpenID 选项卡。 这只发生在 Google,它适用于 Facebook。
您可能会看到此错误的原因之一是,如果您已将您的池配置为开发人员身份验证流,并且提供程序名称为 'accounts.google.com'。您能否检查池中自定义身份验证提供程序的 Cognito 控制台并确保它未设置为 'accounts.google.com'?
问题是我的身份池指向一个已删除的用户池。