AWS Cognito login to return as JSON

Viewed 79

I have this link : https://{application}.auth.us-east-1.amazoncognito.com/oauth2/authorize?response_type=token&client_id={clientid}&redirect_uri=http://localhost

Above link will direct me to login page of Cognito. How do I return the respond as JSON so I can set up the token in cookie or indexedDB ?

1 Answers

I've been researching Cognito.

The OpenId URLs like /oauth2/authorize are part of the Hosted UI. The redirected requests are meant to go to a browser, and you can't configure these to use JSON.

What you will be more interested in is Cognito's API. Requests and responses are all JSON; for example, the InitiateAuth endpoint is analogous to the /authorize endpoint of the Hosted UI.

The part I'm struggling with is that the Hosted UI supports OIDC features like PKCE for sending an authorization code to a server to securely pass the identity. The API doesn't seem to have anything like this.

Related