I have an API http gateway (at say https://example.com) integrated with an API REST gateway which uses a Cognito authorizer. All of this to serve a single-page React application. The behaviour is as expected:
- I launch the Cognito hosted UI and sign in,
- It redirects to the url https://example.com/#id_token=123
- If I use PostMan, I can access that url if I pass that id_token in the Authorization header.
Now my question is: how can I pass the header automatically after signing in so I can visit https://example.com?
I have spent a long time on this and have found many similar posts without an answer:
- How to use the code returned from Cognito to get AWS credentials?
- How can I link cognito token and API authentication header automatically?
- AWS Cognito hosted UI returning id_token in URL
- How can I make the redirect_uri of AWS Cognito (Hosted UI) authenticated?
- Set Authorization header when redirecting client from Cognito to AWS API Gateway
- How do I handle a Cognito auth redirect for a Lambda / API Gateway for UI?