Auth0 Home Blog Docs

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!