Is like that, I use Cognito account system is established, and then also configured the identity pool, it can be applied in Cognito account, and then save some data in the dataset,
Then I want to take advantage of Cognito inside account login alexa, realize the alexa smart skill,
So far, the login has been done, use the aws SDK (js) also can get the dataset of data, but the problem is coming,,,
Logins={};
Logins [' cognito - idp. '+ AWSCognito. Config. The region +' amazonaws.com/'+ poolData. UserPoolId]=token;
AWS. Config. Region=AWSCognito. Config. Region;
AWS. Config. Credentials=new AWS. CognitoIdentityCredentials ({
IdentityPoolId: IdentityPoolId,
Region: AWSCognito. Config. Region,
Logins: Logins
});
Initializes the credentials, use this place, and the token is id_token, but alexa skill can only send it to the access token,
Both token is JWT format, I use it to do a direct web login the demo grasp both token to parse, found is quite like,
The access token +
{
"Kid" : "9 domrdwtmecnopfhvfz6kidwkitdftsda + IkYbtABSQ=",
"Alg" : "RS256
"}
{
Df "sub" : "3123888 e - 76-48 b2-87 e4 - d7c9b65e32ba",
"Token_use" : "access",
"Scope" : "aws. Cognito. Signin. User. Admin",
"Iss" : "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_S5kbwuSkN",
"Exp" : 1499227860,
"The iat" : 1499224260,
"Jit" : "ea9ad8a6 - f13 f3c3-4-920 - e - 65 dff62e9901",
31 imp79ppkscn5if53nei6tqvb "client_id" : "",
"Username" : "[email protected]
"}
IdToken +
{
"Kid" : "Y55SEAf1CCzVkWkYXMfxlNluyiLVfOyc8r4vYnzp8VM=",
"Alg" : "RS256
"}
{
Df "sub" : "3123888 e - 76-48 b2-87 e4 - d7c9b65e32ba",
31 imp79ppkscn5if53nei6tqvb "aud" : ", "
"Email_verified" : true,
"Token_use" : "id",
"Auth_time" : 1499224260,
"Iss" : "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_S5kbwuSkN",
"Cognito: username" : "[email protected]",
"Exp" : 1499227860,
"The iat" : 1499224260,
"Email" : "[email protected]
"}
Below is from alexa skill after landing by lambda get access token
"AccessToken" :.. "
{
"Kid" : "9 domrdwtmecnopfhvfz6kidwkitdftsda + IkYbtABSQ=",
"Alg" : "RS256
"}
{
Df "sub" : "3123888 e - 76-48 b2-87 e4 - d7c9b65e32ba",
"Token_use" : "access",
"Scope" : "aws. Cognito. Signin. User. Admin",
"Iss" : "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_S5kbwuSkN",
"Exp" : 1499152959,
"The iat" : 1499149359,
"Version" : 2,
"Jit" : "f77a82b2-3 eaf - ca - 90 fc - 42 e0228f934ea2",
"Client_id", "6 raclfd4r92uj78m1hr8rfcrmv",
"Username" : "[email protected]
"}
Look from the top, alexa account link should be correct, he gave me a token is also correct,,,,, but this thing how to use the aws document that the ID token is used to realize cognito identity pool access,,, did not say the access token with at first sight,,,, please help warrior
CodePudding user response:
Ability is limited, can't help you, sorry.CodePudding user response:
Ah,,,, disappointed,,, also have no money to pay AWS support,,,,,,,CodePudding user response:
Two usage, is to distinguish by token_use id or access, just saw, hope and help ~ ~