Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cognito login and track referral source

I'm using Amazon Cognito with the Built-In login page. I'd like to provide a link where I can customize my site after the user logs in based on where the user is coming from.

If I change the redirect_uri to a page that is different than configured in the App client settings I'll get a redirect_mismatch error.

If I add a query param it does not preserve it.

https://auth-local.auth.us-west-2.amazoncognito.com/login?response_type=code&client_id=<myid>&redirect_uri=http://localhost:4201/after-login&TEST_QUERY_PARM=1

Goes to:

http://localhost:4201/after-login?code=[code]

There is no TEST_QUERY_PARM that I set in the redirect_uri.

Is there any way I can track where it came from?

-

EDIT: I'm using AWS Chalice/Lambda for backend server

like image 622
Edwin Evans Avatar asked Dec 01 '25 03:12

Edwin Evans


1 Answers

Did you try to configure two application clients each with its own callback URL. So to track calls from different sources you will do something like:

?response_type=code&client_id=<myid_1>&redirect_uri=<myurl_1>
?response_type=code&client_id=<myid_2>&redirect_uri=<myurl_2>

or you can actually configure several callback URLs for one App Client by separating them by a comma.

like image 87
Yuriy P Avatar answered Dec 02 '25 16:12

Yuriy P