Navigating to umbraco throws "invalid request" error

We are getting the following error when trying to get to Umbraco backoffice.

We have added the env variable of:

Umbraco__CMS__WebRouting__UmbracoApplicationUrl

Is there something else we are missing?
Happens both locally and in the web app in azure.

error:invalid_request
error_description:The specified 'redirect_uri' is not valid for this client application.
error_uri:https://documentation.openiddict.com/errors/ID2043

When Umbraco boots, it adds a redirect_uri in the database based on the request. This database record is used for validating OAuth. If this is set incorrectly, or you change the hostname later, or have multiple Umbraco instances look at the same database, you can get this error. It’s really annoying, but redirect_urls are required for OAuth. I think you also need to set the BackOfficeHost…? Not sure though.

So when a user logs in for the first time, redirect_uri is set and any subsequent login from a different domain will cause this error. I think you can find the record in one of the umbracoOpenIddict* database tables and update it manually.

Think you’ll need the same URL in the Security section, like here:

On local you should be able to remove both these settings though and it should just work.

@LuukPeters thank you for the info and @sebastiaan I’ll add the security env property.

Could this be related to running dev locally connected to the uat DB hence the redirect url error?

UAT and dev local sharing a DB is only temporary whilst we get the site ready but i can always just clone to local sql if that fixes it.

Don’t exactly know what it is needed for but it’s related to having a hostname added to your site, localhost should work but a “real” hostname sometimes needs extra config (something like that, I can’t remember exactly).

Absolutely! I have the same issue when using a deployment slot in Azure, because in that case, two Umbraco instances with different URLs connect to the same database and Umbraco will only register one domain automatically.

Fortunately, the redirect_urls property in the database is an array, so you can actually manually add entries to it.

2 Likes

Perfect alright thanks for the help, I’ll have a play and check back here later

Thank you!!!