Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AWS Coginto: where is the metadata URL of Cognito User Pool?

I’m trying to use AWS Cognito as an authorizer for my REST API in AWS API Gateway.

It asks me to fill in the Issuer URL:

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I digged through the AWS Cognito User Pool page, there is no such thing.

I found a related answer here: AWS: Cognito integration with a beta HTTP API in API Gateway?
and I quote:

Issuer URL: Check the metadata URL of your Cognito User Pool 
(construct the URL in this format :: https://cognito-idp.
[region].amazonaws.com/[userPoolId]/.well-known/openid-configuration 
:: look for a claim named "issuer". Copy its Value and paste it here.

I can of course build the url as said above.

But still, where is the metadata URL of my Cognito User Pool????

Am I missing something really basic and being absolutely silly by asking this question?

Where is it??

This is driving me crazy.

>Solution :

The issuer URL of a Cognito User Pool has the following format:

https://cognito-idp.[region].amazonaws.com/[userPoolId]

As you stated correctly, you can get it from Cognito’s well-known metadata endpoint, which is available at

https://cognito-idp.[region].amazonaws.com/[userPoolId]/.well-known/openid-configuration

This file is JSON-formatted and contains an issuer field, which contains the URL mentioned above. The whole file looks like this:

{
   "authorization_endpoint":"https://cognito-idp.[region].amazonaws.com/[userPoolId]/authorize",
   "id_token_signing_alg_values_supported":[
      "RS256"
   ],
   "issuer":"https://cognito-idp.[region].amazonaws.com/[userPoolId]",
   "jwks_uri":"https://cognito-idp.[region].amazonaws.com/[userPoolId]/.well-known/jwks.json",
   "response_types_supported":[
      "code",
      "token"
   ],
   "scopes_supported":[
      "openid",
      "email",
      "phone",
      "profile"
   ],
   "subject_types_supported":[
      "public"
   ],
   "token_endpoint":"https://cognito-idp.[region].amazonaws.com/[userPoolId]/token",
   "token_endpoint_auth_methods_supported":[
      "client_secret_basic",
      "client_secret_post"
   ],
   "userinfo_endpoint":"https://cognito-idp.[region].amazonaws.com/[userPoolId]/userInfo"
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading