From 35caf893d00694aed4c1bca03775c5c57e206d41 Mon Sep 17 00:00:00 2001 From: Torgeir Lebesbye Date: Mon, 20 Nov 2017 10:28:16 +0000 Subject: [PATCH 1/2] Added support for Dataporten's userid-feide scope --- .../rocketchat-custom-oauth/server/custom_oauth_server.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/rocketchat-custom-oauth/server/custom_oauth_server.js b/packages/rocketchat-custom-oauth/server/custom_oauth_server.js index 0e84a0664e3..eb311ef1c58 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; } From 9f4517f948f2fa2d74382769ea820384969aea8b Mon Sep 17 00:00:00 2001 From: Torgeir Lebesbye Date: Mon, 20 Nov 2017 11:31:49 +0000 Subject: [PATCH 2/2] Removed trailing space to comply with Travis test --- packages/rocketchat-custom-oauth/server/custom_oauth_server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rocketchat-custom-oauth/server/custom_oauth_server.js b/packages/rocketchat-custom-oauth/server/custom_oauth_server.js index eb311ef1c58..b2d995d99ce 100644 --- a/packages/rocketchat-custom-oauth/server/custom_oauth_server.js +++ b/packages/rocketchat-custom-oauth/server/custom_oauth_server.js @@ -193,7 +193,7 @@ export class CustomOAuth { if (identity.user && identity.user.userid && !identity.id) { if (identity.user.userid_sec && identity.user.userid_sec[0]) { identity.id = identity.user.userid_sec[0]; - } else { + } else { identity.id = identity.user.userid; } identity.email = identity.user.email;