I am trying to set up redux OIDC to authenticate users then redirect them to the original URL after authentication by passing the original URL path to the state query param on signInRedirect.
I cannot pass the pathname to the auth server in the redirect_uri
as there are only a few specific paths that are accepted by our auth server.
When passing the original path via state when configuring auth setting using extraQueryParams
I can see state is also being generated by redux-oidc and populated with an id.
const settings = {
authority: configuration.authority,
client_id: 'client-id',
redirect_uri: `${window.location.origin}/signin-oidc`,
extraQueryParams: {"state": encodeURIComponent(window.location.pathname)},
response_type: 'code',
scope: `openid profile ${configuration.apiScope}`,
automaticSilentRenew: true,
silentRequestTimeout: 2000,
silent_redirect_uri: `${window.location.origin}/signin-silent`,
userStore: new WebStorageStateStore({ store: new CustomStorage() }),
};
Part of the constructed query to authenticate user, note the first state param is the id generated by redux-oidc, the second state param is from extraQueryParams
specified by me:
Constructed auth query
Is there any way I can override this state id which is generated by redux-oidc and populate it with something meaningful like a redirect to the original path after authenticating the user?