MS Office 365 integration is giving AADSTS90102

I don’t know if anything has changed recently, but after following the guide on integrating ms office AAD auth to erpnext, I am getting AADSTS90102: ‘redirect_uri’ value must be a valid absolute URI.

I even gave all 3 forms of email access as suggested in this discussion:

I tried a lot of things, but still haven’t been able to fix this issue. One reason I think could be happening is the redirect URI being sent from the side of erpnext is not https and also for some reason the http word gets repeated twice in the url. Also the baseurl ( isn’t even mentioned in the redirect URI. Here you can see the redirect uri encoded in the flow:

The redirect uri should be something like this:

Any help would be appreciated

Quoting from azure docs : * Redirect URIs must begin with the scheme https . There are some exceptions for localhost redirect URIs.

Taken from : Redirect URI (reply URL) restrictions - Microsoft Entra | Microsoft Learn

This is the tutorial I followed, but all the video tutorials here are broken and the screenshots are also a bit outdated How To Enable Social Logins

Google also has the same issue

I finally kind of solved this by changing the site configurations of the erp installation.

Disclosure : I am an absolute beginner in ERPNext and this install has been hosted on azure using a bitnami installer, so your file structure and overall system might vary slightly.

But these are my two main config files which were used to fix the auth flow.

Site config:

Here is the key and value that I changed
“host_name”: “

Also in the Common site config :

Notice that i changed webserver_port from the default value of 8000 to an empty string. I don’t know if doing this was entirely safe but this was the only way to make the redirect_uri not mention the port number, I got the idea to do this from Google Settings Error: redirect_uri_mismatch and Configuration

I hope this helps someone who is stuck with this.


Yes, that worked. The key is the “host_name”: “" setting, other wise the local DNS setting is used, which in shared environments is not necessary the same as the registered domain!