Custom oAuth supporting json or plain content_types responses of the identity

pull/1961/head
Omar Qunsul 10 years ago
parent b079e1d605
commit bc99ed1d51
  1. 7
      packages/rocketchat-custom-oauth/custom_oauth_server.coffee

@ -82,7 +82,10 @@ class CustomOAuth
params:
access_token: accessToken
return response.content
if response.data
return response.data
else
return JSON.parse response.content
catch err
error = new Error("Failed to fetch identity from #{@name} at #{@identityPath}. " + err.message)
@ -94,7 +97,7 @@ class CustomOAuth
accessToken = self.getAccessToken query
console.log 'at:', accessToken
identity = JSON.parse(self.getIdentity(accessToken))
identity = self.getIdentity accessToken
# Fix WordPress-like identities having 'ID' instead of 'id'
if identity?.ID and not identity.id

Loading…
Cancel
Save