My OIDC profile endpoint returns this:
{"id":"b94e083c-8ee8-4177-af13-cf87ceab00d2","username":"john","email":"john@gmail.com"}
But dataverse says this error:
edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2Exception: Error getting the user info record from OpenID.
at edu.harvard.iq.dataverse.authorization.providers.oauth2.oidc.OIDCAuthProvider.getUserInfo(OIDCAuthProvider.java:316)
at edu.harvard.iq.dataverse.authorization.providers.oauth2.oidc.OIDCAuthProvider.getUserRecord(OIDCAuthProvider.java:227)
at edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2LoginBackingBean.exchangeCodeForToken(OAuth2LoginBackingBean.java:103)
at edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2LoginBackingBean$Proxy$_$$_WeldSubclass.exchangeCodeForToken(Unknown Source)
Maybe I should explain more. I have already created the user 'john' in my OIDC. I press the 'Login by OpenID' in dataverse and it redirects me to my OIDC properly. I login there and redirected me to dataverse. By looking at logs, I noticed that dataverse can exchange the auth code with OIDC and gets the access token; then, it tries to call the profile endpoint to get user profile. At this point, I get the above error message in dataverser.
Can you find the line number on GitHub?
I think the following method is throwing the exception, but I am not sure.
Optional<UserInfo> getUserInfo(BearerAccessToken accessToken) throws IOException, OAuth2Exception {
// Retrieve data
HTTPResponse response = new UserInfoRequest(this.idpMetadata.getUserInfoEndpointURI(), accessToken)
.toHTTPRequest()
.send();
// Parse/Extract
try {
UserInfoResponse infoResponse = UserInfoResponse.parse(response);
// If error --> oauth2 ex
if (! infoResponse.indicatesSuccess() ) {
ErrorObject error = infoResponse.toErrorResponse().getErrorObject();
throw new OAuth2Exception(error.getHTTPStatusCode(),
error.getDescription(),
BundleUtil.getStringFromBundle("auth.providers.exception.userinfo", Arrays.asList(this.getTitle())));
}
// Success --> return info
return Optional.of(infoResponse.toSuccessResponse().getUserInfo());
} catch (ParseException ex) {
throw new OAuth2Exception(-1, ex.getMessage(), BundleUtil.getStringFromBundle("auth.providers.exception.userinfo", Arrays.asList(this.getTitle())));
}
}
dataverse/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/oidc/OIDCAuthProvider.java
Yeah, auth.providers.exception.userinfo=Error getting the user info record from {0}.
From Bundle.properties
Are you comfortable recompiling and adding some debugging lines?
Unfortunately, I am not a Java developer.
I found the root of the issue. My profile endpoint was returning a different structure than what was expected by dataverse (when calling profile endpoint).
Mohsen Jafari has marked this topic as resolved.
Interesting. So you changed the structure of what your profile endpoint was emitting? Should we add some more documentation to the Dataverse guides?
You know, I have experienced the following stuff when integrating my OIDC with dataverse:
PS: I have used Standard installation approach.
Sounds like we should document all of this. Are you interested in creating an issue? :grinning:
Yes. Where should I create the issue?
@Mohsen Jafari https://github.com/IQSS/dataverse/issues please
I see you opened this, thanks: Add more information about the OpenID button #10392
And OIDC profile endpoint #10393
sure
And
for debug flag, you mean just OIDC, right?
Philip Durbin said:
for debug flag, you mean just OIDC, right?
I think, in general, having a boolean flag in order to have more/verbose information about what have happened (logs) would be really helpful, either regarding OIDC or anything else. For example, if verbose_flag = true, then we see more detailed information about what have happened. As an example, there were some situations where I really needed more information in the dataverse logs to fix the issue but without such a flag I had to pull the codebase put some logs and recompile and so on...
However, I think such a decision may really depend on your development/security strategies. I just shared my basic-level idea :)
Makes sense. Sometimes we'll suggest increasing the logging level here or there: https://guides.dataverse.org/en/6.1/admin/troubleshooting.html#increasing-payara-logging
Are you interested in creating a pull request for any of these issues?
Sorry, but not at the moment.
No worries!
Last updated: Oct 30 2025 at 06:21 UTC