Passing data to action during login using scopes

Hello. This is a continuation of this post.

I need to pass some custom data into action during login and use that data to create a custom claim in the access token. From the post above, I found out I can send a random identifier as a query param of /authorize endpoint and read that param in action using event.request.query (like this => https://dev-my.domain.auth0.com/authorize?randomid=123).

By chance, I also found out I can do the same using scopes. I can send some random scope (like this => scope: 'openid email profile randomid:123') and read it using event.request.query before it gets removed (randomid:123 is not predefined in my API so it will get removed from the token at the end of auth flow).

Is this behavior with scopes intended? I would like to use scopes for this, but if this was not intended I’ll use query parameters instead. Also, I couldn’t find anything about this in the documentation.

Edit: I’m using authorization code flow

Thanks in advance

Hey team! :waving_hand:

Since this topic touches Auth0 Actions, quick heads-up that we’re hosting an Ask Me Anything dedicated to Actions with Gaston Danilo Asis Sanchez, Senior Technical Product Manager. We’ll cover practical usage, new capabilities like Transaction Metadata and Actions Types, plus a peek at what’s next. :sparkles:

  • Submit questions now through Aug 26 :writing_hand:
  • Get detailed written answers live on Aug 27, 9–11 AM PT :speech_balloon:

Earn community points + a badge :trophy:. If you’re exploring how Actions can streamline your auth flows, this is a great time to get direct guidance from the team.
Join the AMA & drop your questions here: August 27 Auth0 Community Ask Me Anything: Actions

Dawid