Including custom fields in getAccessTokenSilently and using them in rules/actions

Hi,

We are trying to include a custom field during the login process. The purpose is to be able to inject dynamic params into payload from rules or actions. Client is a react.js app and we use @auth0/auth0-react library. Noticed that getAccessTokenSilently is extensible to include custom params:

    /**
     * If you need to send custom parameters to the Authorization Server,
     * make sure to use the original parameter name.
     */
    [key: string]: any;

We are using it as following:

const { getAccessTokenSilently } = useAuth0();
const accessToken = await getAccessTokenSilently({
        audience: 'my-audience',
        scope: 'read:current_user',
        'foo': 'bar'
    });

The question is, how we get access to foo=bar from inside the rules or action triggers?
Thanks
Ruben

Hi @rubenhak,

You should be able to read the extra params in the context.request.query object in Rules and the event.request.query object in Actions.

Thank you Stephanie!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.