Unable to override default /callback in .NET SDK library

I am unable to override default /callback route in 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.

Hi @sumit.sachdeva,
Welcome to the Auth0 Community :wave:

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:

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 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.