AWS Cognito Dynamic Query Parameter Values?

0

I am using the Cognito-hosted UI. I'd like to route users back to their original url after successful authentication with their specific query parameter values. It doesnt seem that AWS can handle this. Posting in here in case this is not true.

mmetr
질문됨 일 년 전946회 조회
2개 답변
0

You can use the state parameter to redirect users back to their original URL after authentication with Cognito-hosted UI:

  1. Store the original URL in the state parameter when starting authentication. URL-encode the original URL.
https://<your-domain>.auth.<region>.amazoncognito.com/login?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>&state=<url_encoded_original_url>
  1. In your callback handler, get the state parameter from the authentication response.

  2. Redirect the user to the original URL obtained from the state parameter.

This way, you can redirect users to the correct URL with their specific query parameters after authentication.

profile picture
전문가
답변함 일 년 전
  • Ok - to be clear, I am using the hosted UI. I am not aware of there being a "callback handler". Are you just saying that my redirect uri should have something to handle the state? I am using API Gateway + Lambda to build a serverless app if that helps.

0

Could you please provide detailed implementation steps?

Abhijit
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인