我尝试了此代码,
const cognitoisp = new AWS.CognitoIdentityServiceProvider();
const params = {
AuthFlow: 'REFRESH_TOKEN',
ClientId: '',
UserPoolId: '',
AuthParameters: {
'REFRESH_TOKEN': ''
}
};
cognitoisp.adminInitiateAuth(params, function (err, data) {
if (err) {
console.log('RefreshTokenError: ', err.stack);
} else {
console.log('RefreshTokenResponse: ', data);
}
});
,但不起作用。还是还有其他刷新令牌的方法?
答案 0 :(得分:0)
adminInitiateAuth
函数仅供管理Cognito的人员使用,您需要使用initateAuth:
const params = {
AuthFlow: 'REFRESH_TOKEN_AUTH',
ClientId: 'YOUR_CLIENT_ID!',
AuthParameters: {
'REFRESH_TOKEN': 'THE_REFRESH_TOKEN!'
}
};
cognitoisp.initiateAuth(params, function (err, data) {
if (err) {
console.log('RefreshTokenError: ', err.stack);
} else {
console.log('RefreshTokenResponse: ', data);
}
});