简体   繁体   中英

How do I obtain an Access Token from an Unauthenticated Cognito Identity

I am dealing with a unauthenticated identity, via Cognito and the identity pool.

Here is what I am doing ( via Rest API calls ):

  1. AWSCognitoIdentityService.GetId -- to register the identity
  2. AWSCognitoIdentityService.GetCredentialsForIdentity -- return credentials for the provided identity ID

What I am confused about, is this:

How can I covert the (temporary) AWS Credentials into an Access Token (so that I can perform calls against the AWS API Gateway)?

Or am I thinking about this the wrong way?

Btw, this is what I have, as my AWS Crendetials:

{
  "Credentials": {
    "AccessKeyId": "...",
    "Expiration": 1649299760,
    "SecretKey": "...",
    "SessionToken": "..."
  },
  "IdentityId": "ap-southeast-2:..."
}

If your endpoint should work even for unauthenticated users, then just let it without any authorizer.

The Unauthenticated Identity is just a phantom for a user, no one gets authenticated, so you can't get any authentication token that would guarantee the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM