When integrating Artifactory with Azure OpenID following this KB article here, we sometimes encounter errors like below:
Error handling OAuth2 login: No email was found on the OAuth responseAs explained in the linked article, this error occurs when Artifactory is looking for a property in the returned JSON response but could not find it.
From Artifactory 7.4.0, we can set the below property to $ARTIFACTORY_HOME/etc/artifactory/artifactory.system.properties file and restart Artifactory to tell Artifactory to use this identifier from the Open ID response:
artifactory.oauth.user.info.identifier=xxx
But what if setting the above property still results in the same error?
The answer is, it’s likely that you’re not using an identifier returned from the below UserInfo response.
See the below sample UserInfo response from the Azure document here:
The claims shown in the above response are the only claims returned.
Therefore, when setting the above property, “artifactory.oauth.user.info.identifier”, we should set it to one of the claims returned from the above UserInfo response.
E.g.
artifactory.oauth.user.info.identifier=name artifactory.oauth.user.info.identifier=email