Open brockallen opened 4 years ago
Hi, in the absence of this do you have an example of how to do this manually. I am passing custom state object to siginRedirect with a targeturl in but struggling to work out how to get access to it after redirect ?
mgr.signinRedirect({state:{targetUrl: “https://Mysite.com/somepath “}})
@ed-sparkes try something like this where you handle the callback:
new UserManager({response_mode: 'query'})
.signinRedirectCallback()
.then(user => location.href = user.state.targetUrl)
Thanks @danielmcormond, ill give that a go, i am currently using https://github.com/bjerkio/oidc-react which wraps this library in a React context, it provides and onSignIn event which provides the User but the state is coming through undefined, looks like maybe the state is only available on the signinRedirectCallback and this has been called and therefore state lost by the time the onSignIn event is called. I will confirm and raise a pr on oidc-react if this is the case
and redirect automatically in signinCallback