# Unable to override default /callback in .NET SDK library

**URL:** <https://community.auth0.com/t/unable-to-override-default-callback-in-net-sdk-library/140499>\
**Category:** Get Help\
**Tags:** application, sso\
**Created:** [August 6, 2024, 10:36am UTC](https://community.auth0.com/t/unable-to-override-default-callback-in-net-sdk-library/140499 "2024-08-06T10:36:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumit.sachdeva](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sumit.sachdeva](https://community.auth0.com/u/sumit.sachdeva)\
**Post date:** [August 6, 2024, 10:36am UTC](https://community.auth0.com/t/unable-to-override-default-callback-in-net-sdk-library/140499/1 "2024-08-06T10:36:29Z")

</div>

I am unable to override default /callback route in [ASP.NET](http://ASP.NET) SDK of Auth0. Below code does not work as expected-`var authenticationProperties = new LoginAuthenticationPropertiesBuilder() // Indicate here where Auth0 should redirect the user after a login. // Note that the resulting absolute Uri must be added to the // **Allowed Callback URLs** settings for the app. .WithRedirectUri(returnUrl) .Build();`  
I tried to provide a different returnUrl and mentioned same in app settings in Auth0 portal. It still picks default /callback route everytime.

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [August 21, 2024, 4:49pm UTC](https://community.auth0.com/t/unable-to-override-default-callback-in-net-sdk-library/140499/2 "2024-08-21T16:49:56Z")

</div>

Hi @sumit.sachdeva,  
Welcome to the Auth0 Community 👋

It’s not clear to me if you want to change the OIDC callback or you want the user to go back to a specific page after login.

The `WithRedirectUri ()` method allows you to redirect the user to a specific path after authentication. The default value is “/”.

If you want to change the default `/callback` path, which is the path where the OIDC middleware handles the tokens issued by Auth0, you should set this when you configure the middleware:

```csharp
builder.Services
    .AddAuth0WebAppAuthentication(options => {
      options.Domain = builder.Configuration["Auth0:Domain"];
      options.ClientId = builder.Configuration["Auth0:ClientId"];
      options.CallbackPath = "<HERE_YOUR_CALLBACK_PATH>";
    });

```

Be aware that the [`CallbackPath`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.remoteauthenticationoptions.callbackpath) property is intended to be handled by the OIDC middleware. You can change it just in case it conflicts with an existing endpoint in your application. Normally you don’t need to change it, and you can’t override its behavior anyway.

This is how the ASP.NET Core OIDC middleware works. The Auth0 SDK is just a wrapper around it.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 17, 2025, 1:26pm UTC](https://community.auth0.com/t/unable-to-override-default-callback-in-net-sdk-library/140499/3 "2025-04-17T13:26:12Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
