I'm having trouble figuring out the purpose of customState
and if/how I can utilize it to pass data to the return url. Specifically I wish to route the user back to their original location after being signed in. I thought I could pass the original url to the parameter customState
and have it returned back to me in the return url POST
, but it appears to be encoded or perhaps replaced with a different value.
Here is what I want to achieve:
- Anonymous user visits
/page/protected
which requires authentication. - Code calls
passport.authenticate
which in turn redirects the user to sign in. - User signs in and is returned to the pre-configured return url e.g.:
/auth/oidc/return
. - Code handles extracting information from form-post data.
- User is directed back to
/page/protected
.