Integrating with the oAuth 2.0 Authentication module

Currently attempting to implement an oAuth 2 server in our internal business management app and would like our users to be able to login via their accounts to YouTrack via the oAuth 2 authentication provider.

So far I have the authorization flow working fine and can see the Bearer token being issued to the user details end point correctly. Using debug I can see the user details are collected via the bearer token and provided as a PHP stdClass object json_encode 'd and returned to the GET Request as the response.

However no user is being created in the YouTrack hub with these details and the user is left at the youtrack login page with no errors visible. I've mapped the columns as detailed here:

Any ideas if I should be returning the user details in a different format? Docs are a little scarce on how the details should be returned... 

Comment actions Permalink

Almost certain this issue is between seat and keyboard.. Either the mappings aren't in the right format to match up to a php json encoded object response or the object response isn't in the required format...

Looking in `tail -f youtrack/logs/*/*.log`

20 Dec 2017 09:44:42,784 INFO [GodMode ] [&state=gxAi] Federated auth land for module [0218ca66-e81c-407a-85dba77be] failed.
java.lang.IllegalStateException: getValueByPath(json, aut…userIdPath)!!.textValue() must not be null
at jetbrains.jetpass.auth.module.oauth2.dnq.client.OAuth2API.convertUserInfoJsonToUserDetails(OAuth2API.kt:80)
at jetbrains.jetpass.auth.module.oauth2.dnq.client.OAuth2API.getUserDetails(OAuth2API.kt:49)
at jetbrains.jetpass.auth.module.oauth2.dnq.persistence.OAuth2FederatedAuthenticationHandler.authenticate(OAuth2FederatedAuthenticationHandler.kt:59)
at jetbrains.jetpass.auth.module.oauth2.dnq.persistence.OAuth2FederatedAuthenticationHandler.authenticate(OAuth2FederatedAuthenticationHandler.kt:17)

Comment actions Permalink



Was returning the User ID as a integer value representing the users id oauth server side. This needed to be a string value representing the username value. All working perfectly now

Comment actions Permalink

Thank you for sharing the solution! Please let us know if you have any other questions. 


Please sign in to leave a comment.