diff --git a/packages/rocketchat-custom-oauth/server/custom_oauth_server.js b/packages/rocketchat-custom-oauth/server/custom_oauth_server.js index b8983bf8a4d3..1423f3d4236a 100644 --- a/packages/rocketchat-custom-oauth/server/custom_oauth_server.js +++ b/packages/rocketchat-custom-oauth/server/custom_oauth_server.js @@ -191,7 +191,11 @@ export class CustomOAuth { // Fix Dataporten having 'user.userid' instead of 'id' if (identity.user && identity.user.userid && !identity.id) { - identity.id = identity.user.userid; + if (identity.user.userid_sec && identity.user.userid_sec[0]) { + identity.id = identity.user.userid_sec[0]; + } else { + identity.id = identity.user.userid; + } identity.email = identity.user.email; } // Fix for Xenforo [BD]API plugin for 'user.user_id; instead of 'id'