Reputation: 486
The idea is to perform login/authentication + autorization with AWS Cognito and Google Login as Federated entity.
Everything is done on the client side using AWS javascript SDK.
I can login using https://.auth.eu-central-1.amazoncognito.com/oauth2/authorize?identity_provider=Google&redirect_uri=https://&response_type=token&client_id=<Client_id>. I redirects me to my website and adds an access_token in the URL. I can get back AWS access and secret keys with the CognitoIdentityCredentials
function.
Questions:
access_key
and secret_key
?Upvotes: 0
Views: 644
Reputation: 486
Ok, it appears I was confused...
When logged in with Cognito, there are two JWT tokens in the URL (this part is important):
The id_token
must be sent in the Authorization
header when calling API Gateway to authorize the requests. The header is automatically set if you use the AWS Amplify SDK.
I will add more info when I manage to acheive the full flow from login/register to API Gateway requests.
Side note: I thing I got confused when I read all the pieces of code online (Github, Medium, etc.) where they all use Cognito Identity Pool after the login part.
Upvotes: 1