AWS Amplify uses guest credentials, not authenticated creds, in API requests


I am using the AWS Amplify library with MobileHub.

I have a Cognito User Pool connected, and an API Gateway (which communicates with Lambda functions). I’d like my users to sign before accessing resources, so I’ve enabled “mandatory sign-in” in MobileHub User Sign-In page, and the Cloud Logic page.

Authentication works fine, but when I send a GET request to my API, I receive this error:

I understand that Amplify generates guest credentials, and has put these in my GET request. Since I’ve enabled “mandatory signin”, this doesn’t work.

But why is it use guest credentials? I’ve signed in — shouldn’t it use those credentials? How do I use the authenticated user’s information?


EDIT: Here is the code from the Lambda function:

lambda function:

And these small helper functions:




I’m following the guide “serverless-stack” and was prompt with the same warning message, I was logging in correctly and logging out correctly and did not understand why the warning message.
In my case, in the Amplify.configure I skip to add the identity pool id, and that was the problem, User pools and federated identities are not the same.

(English is not my native language)

Leave a Reply