How to replace the redirect url from localhost to some other url?

Hello Experts!

I am new to Okta. I am using AuthorizationCodeFlow to get the token from a .Net windows application.
I am using https://localhost:44311 as my Sign-in redirect URI.

var _httpListener = new HttpListener();

string _authorizationRequest = [Request to Okta server with clientid, client secret, redirect url…etc]

var context = _httpListener.GetContext();
_authorizationCode = context.Request.QueryString.Get(“code”);

My question is how to replace the https://localhost:44311 with some other url?
Note: Mine is not a web application, its a .Net windows application.
Any help would be appreciated.


@devhare.mangesh Hi, it looks like localhost is one of your servers? What do you mean “some other url”? Is there an example?

Hello Lijia,

Sorry for the confusion. localhost is just my redirect url from where I can get the auth code in my httplistener object. I want to replace that in production with some real url e.g. etc. How can I do that? Should I just replace localhost with production url?


Hello All,

Just to be more clear on the issue that I am facing…
I am using the HttpListener as explained in the example at this link:
When I am not using the localhost as my redirect URL and the call goes to the method GetContextAsync() or GetContex()
// Waits for the OAuth authorization response.
var context = await http.GetContextAsync();

It does not get any response and I am not able to get the context. (Might be because I am running the windows application on the local machine and the page got redirected to the url other than localhost). When I am using localhost as a redirect URL, I am able to get the context and I am able to get the Auth code also from the response.

My issue is how to get this working with the redirect url other than localohost?

Thanks once again,