Skip to content

Commit

Permalink
Custom OAuth fixes for Reddit (#2921)
Browse files Browse the repository at this point in the history
* Fix typo with @tokenSentVia in Custom OAuth

* Make custom OAuth work with Reddit
  • Loading branch information
wtsarchive authored and engelgabriel committed Apr 18, 2016
1 parent 9e9848f commit d8aba3f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/rocketchat-custom-oauth/custom_oauth_server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d8aba3f

Please sign in to comment.