diff --git a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee index d2bae25b8251..baa17cb6a6dc 100644 --- a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee +++ b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee @@ -122,7 +122,16 @@ class CustomOAuth if identity?.CharacterID and not identity.id identity.id = identity.CharacterID - + + # Fix Dataporten having 'user.userid' instead of 'id' + if identity?.user?.userid and not identity.id + identity.id = identity.user.userid + identity.email = identity.user.email + + # Fix general 'userid' instead of 'id' from provider + if identity?.userid and not identity.id + identity.id = identity.userid + # console.log 'id:', JSON.stringify identity, null, ' ' serviceData = @@ -135,7 +144,7 @@ class CustomOAuth serviceData: serviceData options: profile: - name: identity.name or identity.username or identity.nickname or identity.CharacterName + name: identity.name or identity.username or identity.nickname or identity.CharacterName or identity.user?.name # console.log data