diff --git a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee index 0b7237c29921..faa5117d3139 100644 --- a/packages/rocketchat-custom-oauth/custom_oauth_server.coffee +++ b/packages/rocketchat-custom-oauth/custom_oauth_server.coffee @@ -55,6 +55,7 @@ class CustomOAuth response = undefined try response = HTTP.post @tokenPath, + auth: config.clientId + ':' + OAuth.openSecret(config.secret) headers: Accept: 'application/json' 'User-Agent': @userAgent @@ -80,7 +81,7 @@ class CustomOAuth headers = 'User-Agent': @userAgent # http://doc.gitlab.com/ce/api/users.html#Current-user - if @accessTokenSentVia is 'header' + if @tokenSentVia is 'header' headers['Authorization'] = 'Bearer ' + accessToken else params['access_token'] = accessToken @@ -107,6 +108,10 @@ class CustomOAuth identity = self.getIdentity accessToken + # Fix for Reddit + if identity?.result + identity = identity.result + # Fix WordPress-like identities having 'ID' instead of 'id' if identity?.ID and not identity.id identity.id = identity.ID