Access to state inside Pre Registration Hooks

My goal is to verify if the state token is still valid inside my own personal application. In the Pre Registration Hook, I would like to get the state so I can make a call to my back end for some extra validation.

Front end:

    domain: 'not.really.a.domain',
    clientID: 'myAuth0ClientId',
    redirectUri: `http://localhost:3001/callback`,
    responseType: 'token id_token',
    scope: 'openid profile email',
    state: 'THIS IS MY APP SPECIFIC TOKEN',
  });
  web.authorize();```

Hook:

```module.exports = function (user, context, cb) {
  var response = {};

  console.log(context.state) // ??
  response.user = user;

  cb(null, response);
};```

How can I access the state passed in an .authorize() call, inside a pre registration hook? Is it possible or should I approach this problem in some other way?

Thank you in advance!
1 Like

I also need this. I can not figure it out…

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!