ユーザープールの資格情報でのみ、IDプールなしでユーザーを認証する方法/ IdentityPoolId?私は私retrun例の方法Cognitoのユーザープールの資格情報でユーザーを認証します。
cognitoUser.changePassword('oldPassword', 'newPassword', function(err, result) {}
ためCognitoUser.jsからのエラーを呼び出すときに、リンクで https://github.com/aws/amazon-cognito-identity-js
例4は、上記の文字列、アイデンティティプール、 で/だけのために働く602から604
if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {
return callback(new Error('User is not authenticated'), null);
}
私が電話するとき
cognitoUser.getSession(function(err, session) {if (err) {
alert(err);
return;
}
console.log('session validity: ' + session.isValid());
それは私にセッショントークンを与えます。私は
Argument of type '{ Logins: {}; }' is not assignable to parameter of type 'CognitoIdentityOptions'.
は、私が達成しようとしているどのようなエラー与える
const logins = {};
logins['cognito-idp.' + environment.region + '.amazonaws.com/' + environment.UserPoolId] = session.getIdToken().getJwtToken();
// Add the User's Id Token to the Cognito credentials login map.
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
Logins: logins
});
::私は、ユーザーを認証しようとしている方法
どのようにcognitoを理解することが
1)アイデンティティプールなしで認証されたユーザープールユーザー
2)ユーザーの認証方法は?
3)オブジェクトCognitoUserは2 propretiesいる :
- セッション
- signInUserSession
彼らは何ですか? 正しく使用するには?
P.S.このように使用すると、すべて正常に動作しますが、IDプールなしで達成する必要があります
const creds = new AWS.CognitoIdentityCredentials({
IdentityPoolId: environment.IdentityPoolId, // your identity pool id here
Logins: {
// Change the key below according to the specific region your user pool is in.
[`cognito-idp.${environment.region}.amazonaws.com/${environment.UserPoolId}`]: session.getIdToken().getJwtToken()}},
{
region: environment.region
});
AWS.config.credentials = creds;
おかげで、問題は、更新され のgetSession - >セッションがidTokenトークン私を与える:CognitoIdToken、refreshToken:CognitoRefreshToken、accessToken:()CognitoAccessToken) GETCURRENTUSERを - でのlocalStorage –