I am using OpenId Connect. When a user navigates to some Url in our app, after the login we want the user to get redirected back to the original Url they navigated to.
For doing that, I tried the following - it’s also described at stackoverflow.
Notifications = new OpenIdConnectAuthenticationNotifications
{
RedirectToIdentityProvider = async n =>
{
n.ProtocolMessage.RedirectUri =
String.Format("{0}?ReturnUrl={1}", _oktaRedirectUrl, HttpUtility.UrlEncode(n.OwinContext.Request.Uri.ToString()));
},
…
In the above, _oktaRedirectUrl is the Uri that is whitelisted in the client app settings.
When I run this I get the following error from Okta:
Error Code: invalid_request
Description: The ‘redirect_uri’ parameter must be an absolute URI that is whitelisted in the client app settings.
Any suggestions on resolving the above problem or some other way of implementing it? Thx.