# Callback URL uses http instead of https

**URL:** <https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371>\
**Category:** Get Help\
**Tags:** passwordless-email-connection, connections\
**Created:** [January 31, 2023, 1:31pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371 "2023-01-31T13:31:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maury](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maury/32/33197_2.png) [@maury](https://community.auth0.com/u/maury)\
**Post date:** [January 31, 2023, 1:31pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371/1 "2023-01-31T13:31:22Z")

</div>

Hey 👋, I have added Auth0 to my MVC app, it works perfectly in DEVELOPMENT but on PRODUCTION(DigitalOcean) it gives me that I got a Callback URL mismatch:

Log:

> {  
> “date”: “2023-01-31T13:18:48.936Z”,  
> “type”: “f”,  
> “description”: “Callback URL mismatch. [Give yourself a better website » MY DOMAIN](http://my-domain.com/callback) is not in the list of allowed callback URLs”,  
> “connection\_id”: “”,  
> “ip”: “2800:810:5a8:80c2:f000:aac2:2f68:4aeb”,  
> “user\_agent”: “Chrome 109.0.0 / Windows 10.0.0”,  
> “details”: {  
> “body”: {},  
> “qs”: {  
> “client\_id”: “vHcUKPl8hr4AbiAAEEP8jUhP3IZQaPQQ”,  
> “redirect\_uri”: “[Give yourself a better website » MY DOMAIN](http://my-domain.com/callback)”,  
> “response\_type”: “id\_token”,  
> “scope”: “openid profile”,  
> “response\_mode”: “form\_post”,  
> “nonce”: “638107679286067585.OGZlNTI2OWQtNDlmMi00M2JjLWFhMTYtY2I0M2E5NTMyZjY1NTIxZTQ0NTUtMzU2ZS00MTYwLWJlNmQtOWU2ODMxYzUzY2E4”,  
> “auth0Client”: “eyJuYW1lIjoiYXNwbmV0Y29yZS1hdXRoZW50aWNhdGlvbiIsInZlcnNpb24iOiIxLjEuMCJ9”,  
> “state”: “CfDJ8HoRyNfl4AROnvm-SSYUBOAswwYmKypXEYaTkYtEzR9YRjFGsgATtG8ufYgKnz-5XdEtzSv3wzWwbAUCx08JUuxZJSX5gdTWSDG5dkAKJbE13DzFl9UWXcM0BpAz9EI2F8CnZ-wA0MUiQ2gZR\_jT6irnzAyQDwQAw5SSIXbiekcWD6z0DU40tMkJEknSuWif89-CPniUu8QINMlJEYOotBwc-0DcMq6hGM7LE2sYIDtsvhexpFpVcOepSm8aaqy\_OJXBINj4kah95ZvFi8Jh\_Wf4m3m5XU4NOE0-k69OrZ9bN5rV7Jt6h\_Q5K718iW1nsw”,  
> “x-client-SKU”: “ID\_NET6\_0”,  
> “x-client-ver”: “6.25.1.0”  
> },  
> “error”: {  
> “message”: “Callback URL mismatch. [Give yourself a better website » MY DOMAIN](http://my-domain.com/callback) is not in the list of allowed callback URLs”,  
> “oauthError”: “Callback URL mismatch. [Give yourself a better website » MY DOMAIN](http://my-domain.com/callback) is not in the list of allowed callback URLs. Please go to ‘[https://manage.auth0.com/#/applications/vHcUKPl8hr4AbiAAEEP8jUhP3IZQaPQQ/settings](https://manage.auth0.com/#/applications/vHcUKPl8hr4AbiAAEEP8jUhP3IZQaPQQ/settings)’ and make sure you are sending the same callback url from your application.”,  
> “payload”: {  
> “message”: “Callback URL mismatch. [Give yourself a better website » MY DOMAIN](http://my-domain.com/callback) is not in the list of allowed callback URLs”,  
> “code”: “unauthorized\_client”,  
> “status”: 403,  
> “name”: “CallbackMismatchError”,  
> “authorized”: [  
> “[Give yourself a better website » MY DOMAIN](https://my-domain.com/callback)”  
> ],  
> “attempt”: “[http://my-domain/callback](http://my-domain/callback)”,  
> “client”: {  
> “clientID”: “vHcUKPl8hr4AbiAAEEP8jUhP3IZQaPQQ”  
> },  
> “log\_url”: “[https://manage.auth0.com/#/logs/](https://manage.auth0.com/#/logs/)”  
> },  
> “type”: “callback-url-mismatch”  
> },  
> “session\_id”: “gl9C4ZCBlTQNbYASgKew0mKPR6vmUwVh”  
> },  
> “hostname”: “[dev-ggxof8bd75l4qzbi.us.auth0.com](http://dev-ggxof8bd75l4qzbi.us.auth0.com)”,  
> “auth0\_client”: {  
> “name”: “aspnetcore-authentication”,  
> “version”: “1.1.0”  
> },  
> “log\_id”: “90020230131131851753889066341659355572805083499088314386”,  
> “\_id”: “90020230131131851753889066341659355572805083499088314386”,  
> “isMobile”: false,  
> “id”: “90020230131131851753889066341659355572805083499088314386”  
> }

Auth0 config:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/e/ee5c66f6d919ae3cbbf3154f32ca220b89490a4c.png)

Program.cs:

> using Auth0.AspNetCore.Authentication;  
> using Microsoft.Data.Sqlite;  
> using Microsoft.EntityFrameworkCore;  
> var builder = WebApplication.CreateBuilder(args);  
> if (Environment.GetEnvironmentVariable(“ENVIRONMENT”) == “DEVELOPMENT”)  
> {  
> var inMemorySqlite = new SqliteConnection(“Data Source=Shareable;Mode=Memory;Cache=Shared”);  
> builder.Services.AddDbContext(  
> options =\> options.UseSqlite(inMemorySqlite).LogTo(Console.WriteLine, LogLevel.Information)  
> );  
> builder.Services.AddScoped\<DbContext, FeatureFlagContext\>();  
> }  
> else  
> {  
> var postgreSqlConnectionString = Environment.GetEnvironmentVariable(  
> “RELATIONAL\_DATABASE\_CONNECTION\_STRING”  
> );  
> builder.Services.AddDbContext(  
> options =\> options.UseNpgsql(postgreSqlConnectionString)  
> );  
> builder.Services.AddScoped\<DbContext, FeatureFlagContext\>();  
> }  
> // Add services to the container.  
> builder.Services.AddControllersWithViews();  
> builder.Services.AddAuth0WebAppAuthentication(options =\>  
> {  
> options.Domain = Environment.GetEnvironmentVariable(“AUTH0\_DOMAIN”);  
> options.ClientId = Environment.GetEnvironmentVariable(“AUTH0\_CLIENT\_ID”);  
> });  
> var app = builder.Build();  
> // Configure the HTTP request pipeline.  
> if (!app.Environment.IsDevelopment())  
> {  
> app.UseExceptionHandler(“/Home/Error”);  
> // The default HSTS value is 30 days. You may want to change this for production scenarios, see [Enforce HTTPS in ASP.NET Core | Microsoft Learn](https://aka.ms/aspnetcore-hsts).  
> app.UseHsts();  
> }  
> using (var scope = app.Services.CreateScope())  
> {  
> var services = scope.ServiceProvider;  
> DbContext context;  
> if (Environment.GetEnvironmentVariable(“ENVIRONMENT”) == “DEVELOPMENT”)  
> {  
> context = services.GetRequiredService();  
> context.Database.Migrate();  
> }  
> }  
> app.UseHttpsRedirection();  
> app.UseStaticFiles();  
> app.UseRouting();  
> app.UseCookiePolicy();  
> app.UseAuthentication();  
> app.UseAuthorization();  
> app.MapControllerRoute(name: “default”, pattern: “{controller=Home}/{action=Index}/{id?}”);  
> app.Run();  
> public partial class Program { }

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 31, 2023, 11:18pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371/3 "2023-01-31T23:18:56Z")

</div>

Hi @maury,

Thanks for reaching out to the Auth0 Community!

I have just investigated your tenant logs and found that there was indeed a Callback URL mismatch error.

From the logs, I found that the login request was passing in a different URL for the `redirect_uri` than the one expected in the Callback URL.

Given that, I recommend checking your `/authorize` request, specifically the `redirect_uri` query parameter, to make sure the URL points to the URL specified in your Allowed Callback URLs of your Application’s settings.

I hope this helps!

Please let me know if you have any additional questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![maury](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maury/32/33197_2.png) [@maury](https://community.auth0.com/u/maury)\
**Post date:** [February 1, 2023, 1:34pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371/4 "2023-02-01T13:34:58Z")

</div>

Hey @rueben.tiow 👋,

Thanks for reply my thread.

Would you explain me like I’m five this?:

> Given that, I recommend checking your `/authorize` request, specifically the `redirect_uri` query parameter, to make sure the URL points to the URL specified in your Allowed Callback URLs of your Application’s settings.

I didn’t understand pretty well what I have to do. Where I check my `/authorize` request? The `redirect_uri` points me that it’s fetching the url with `HTTP`

 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/8/d833a314f0076821e6b2fc0752de3541182e16ff.png)  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/d/5d255efcf156a26947daff5dff5df38935bde307.png)

But in my allowed callback urls I have it with `httpS`

![image](https://global.discourse-cdn.com/auth0/original/3X/8/2/827201228bef59ae5bc07b98af4a0865de338b17.png)

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 1, 2023, 9:09pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371/5 "2023-02-01T21:09:56Z")

</div>

Hi @maury,

Thank you for your reply.

Essentially, you will need both the `redirect_uri` and Callback URL to **match**.

For this case, you can add the `http` URL to your Allowed Callback URLs list and give the login another try. It should fix the issue.

Please let me know how this goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![maury](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maury/32/33197_2.png) [@maury](https://community.auth0.com/u/maury)\
**Post date:** [February 1, 2023, 9:22pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371/6 "2023-02-01T21:22:45Z")

</div>

I had to add this to my Program.cs to make it work:

> app.UseForwardedHeaders(new ForwardedHeadersOptions  
> {  
> ForwardedHeaders = ForwardedHeaders.XForwardedProto  
> });

Thank you for your time.

---

<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:** [February 15, 2023, 9:23pm UTC](https://community.auth0.com/t/callback-url-uses-http-instead-of-https/99371/7 "2023-02-15T21:23:41Z")

</div>

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