Microsoft Outlook oAuth2 error

Describe the problem/error/question

I was following the documentation to add credentials in order to acces my Outlook mailbox.
I created the credentials like in this video: https://www.youtube.com/watch?v=aqr_PwR1Sgc&t=11s
Everything was fine until I tested it in my n8n by clicking on “Create account”: I got this error message:

The callback is https://MY_N8N_URL/rest/oauth2-credential/callback, which works.
The authorization URL Sign in to your account
The access token URL Sign in to your account
The client ID and client secret are correct.

On Microsoft’s website here is the manifest:

{
	"id": REDACTED",
	"deletedDateTime": null,
	"appId": "REDACTED",
	"applicationTemplateId": null,
	"disabledByMicrosoftStatus": null,
	"createdDateTime": REDACTED",
	"displayName": "REDACTED",
	"description": null,
	"groupMembershipClaims": null,
	"identifierUris": [],
	"isDeviceOnlyAuthSupported": null,
	"isFallbackPublicClient": null,
	"nativeAuthenticationApisEnabled": null,
	"notes": null,
	"publisherDomain": "REDACTED.onmicrosoft.com",
	"serviceManagementReference": null,
	"signInAudience": "AzureADandPersonalMicrosoftAccount",
	"tags": [],
	"tokenEncryptionKeyId": null,
	"samlMetadataUrl": null,
	"defaultRedirectUri": null,
	"certification": null,
	"optionalClaims": null,
	"requestSignatureVerification": null,
	"addIns": [],
	"api": {
		"acceptMappedClaims": null,
		"knownClientApplications": [],
		"requestedAccessTokenVersion": 2,
		"oauth2PermissionScopes": [],
		"preAuthorizedApplications": []
	},
	"appRoles": [],
	"info": {
		"logoUrl": null,
		"marketingUrl": null,
		"privacyStatementUrl": null,
		"supportUrl": null,
		"termsOfServiceUrl": null
	},
	"keyCredentials": [],
	"parentalControlSettings": {
		"countriesBlockedForMinors": [],
		"legalAgeGroupRule": "Allow"
	},
	"passwordCredentials": [
		{
			"customKeyIdentifier": null,
			"displayName": "REDACTED",
			"endDateTime": "REDACTED",
			"hint": "ipq",
			"keyId": "REDACTED",
			"secretText": null,
			"startDateTime": "REDACTED"
		}
	],
	"publicClient": {
		"redirectUris": []
	},
	"requiredResourceAccess": [
		{
			"resourceAppId": "REDACTED",
			"resourceAccess": [
				{
					"id": "REDACTED",
					"type": "Scope"
				}
			]
		}
	],
	"verifiedPublisher": {
		"displayName": null,
		"verifiedPublisherId": null,
		"addedDateTime": null
	},
	"web": {
		"homePageUrl": null,
		"logoutUrl": null,
		"redirectUris": ["https://MY_N8N_WEBSITE/rest/oauth2-credential/callback"],
		"implicitGrantSettings": {
			"enableAccessTokenIssuance": false,
			"enableIdTokenIssuance": false
		},
		"redirectUriSettings": [
			{
				"uri": "https://MY_N8N_WEBSITE/rest/oauth2-credential/callback",
				"index": null
			}
		]
	},
	"servicePrincipalLockConfiguration": {
		"isEnabled": true,
		"allProperties": true,
		"credentialsWithUsageVerify": true,
		"credentialsWithUsageSign": true,
		"identifierUris": false,
		"tokenEncryptionKeyId": true
	},
	"spa": {
		"redirectUris": []
	}
}

What is the error message (if any)?

AADSTS90102: ‘redirect_uri’ value must be a valid absolute URI.

Please share your workflow

I have my dockerized n8n running for days on my server. Everything runs fine, I don’t have any problem with other credentials, it’s only this one.

Information on your n8n setup

  • n8n version: 1.79.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Debian 12

Hey @djcaesar9114
Does your n8n instance have a public domain or you are working in a local network?

I’ve had similar issue on my home network on which I don’t have a domain setup (just a reverse proxy) and I resolved it by doing the credential approval from the server itself, not from my laptop.

I have a public domain, such as https//myn8nwebsite.com. I really don’t know what happens here…

You probably already checked this but Looking at the manifest file you shared, I noticed the redirect URI contains https://MY_N8N_WEBSITE/rest/oauth2-credential/callback.
If MY_N8N_WEBSITE is a placeholder that you replaced with your actual domain, double-check that your Azure AD application has the correct and complete URL registered. Even a single trailing space can cause a mismatch error.

Yes, of course I put “MY_N8N_WEBSITE” to mask my real URL, but it’s something like “example.com” and the full URL responds.

1 Like

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