我正在使用Congnito用户池来执行API网关授权,该工作正常 . 现在,我正在尝试将Instagram添加为登录提供程序之一,因为我在联合身份中创建了 Custom Authentication Provider 并使用以下代码:
var cognitoidentity = new AWS.CognitoIdentity({ apiVersion: '2014-06-30' });
var params = {
IdentityPoolId: 'us-east-1:7d99e750-.....',
Logins: {
'login.instagram': 'Access-Token-Returned-By-Instagram',
},
TokenDuration: 60
};
cognitoidentity.getOpenIdTokenForDeveloperIdentity(params, function (err, data) {
if (err) {
console.log(err, err.stack);
} else {
console.log(data);
var idParams = {
IdentityId: data['IdentityId'],
Logins: {
'cognito-identity.amazonaws.com': data['Token']
}
};
cognitoidentity.getCredentialsForIdentity(idParams, function (err2, data2) {
if (err2) console.log(err2, err2.stack); // an error occurred
else console.log(data2); // successful response
});
}
});
我能够获得 accessToken 和 sessionToken ,但是,我仍然无法找到一种方法来获取API网关要求授权传入请求的 idToken 和 accessToken .
我试着研究SDK以及AWS论坛,但我仍然无法找到使用自定义联合身份提供程序来授权使用cognito用户池的API网关的方法 .