How to resolve redirect_uri_mismatch error when setting up OAuth on Artifactory?

Shai Ben-Zvi
2019-07-17 09:24

Subject 

How to resolve redirect_uri_mismatch error when setting up OAuth on Artifactory?

Description

When trying to set up OAuth authentication against Artifactory, you may encounter the following error:
[ERROR] (o.a.a.o.OAuthHandler:335) – Error handling OAuth2 login: OAuth2 authentication server error: redirect_uri_mismatch

The above means a URL mismatch between what is configured in the OAuth provider and how Artifactory expects it to be accessed.

Resolution

Usually, this error happens when the custom base URL does not match what you submitted on the OAuth provider.
Artifactory expects to be accessed through well-defined URL without additional suffixed such as #home or /webapp/#/home.
For example, if the OAuth is Github and the homepage URL in Github is: https://myartifactory-address/artifactory/#home, then you should use a custom base URL in Artifactory: https://myartifactory-address/artifactory