How to retrieve the referrer URL in an Auth0 Post Login Action?

Hi @b.neugebauer,

There is not an out-of-the-box way to access the URL the user originally visited in an Action. I did a bit of testing and was able to access the URL in this (somewhat hacky) way:

In my React app, I am initializing Auth0 with the acr_values set to window.location.origin. Example:

const providerConfig = {
  domain: config.domain,
  clientId: config.clientId,
  cacheLocation: 'localstorage',
  authorizationParams: {
    redirect_uri: config.callbackURL,
    acr_values: `${window.location.origin}`
  },
};

In my Action, I can access event.transaction.acr_values and see an array with the initial window.location.origin URL. This is the result of console.logging the event object in my action:

Screenshot 2024-11-12 at 12.27.28 PM

Note that the above code is an example and should be tested in a development environment first before adding to production. Additionally, this may vary depending on the SDK you are using. I just used our React SDK as an example.

Please let me know if you have any additional questions or if you run into any issues!

Best,

Mary Beth