Skip to content

[New] Added oauth2 userinfo endpoint#6554

Merged
engelgabriel merged 2 commits into
developfrom
fix-oauth
Apr 3, 2017
Merged

[New] Added oauth2 userinfo endpoint#6554
engelgabriel merged 2 commits into
developfrom
fix-oauth

Conversation

@geekgonecrazy

Copy link
Copy Markdown
Contributor

@RocketChat/core

Added as per part of the spec: https://connect2id.com/products/server/docs/api/userinfo

Ran into an application that needed this on the server to finish the oauth login process. Since its part of the spec, I went ahead and added it.

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6554 March 31, 2017 20:05 Inactive

accessToken = req.headers.authorization.replace('Bearer ', '')

token = oauth2server.oauth.model.AccessTokens.findOne accessToken: accessToken

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is return an exception if the token was not found?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added checks on this and the user.


token = oauth2server.oauth.model.AccessTokens.findOne accessToken: accessToken

user = RocketChat.models.Users.findOneById(token.userId);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a check here as well

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6554 March 31, 2017 21:57 Inactive
@rodrigok rodrigok added this to the 0.55.0 milestone Mar 31, 2017
@engelgabriel engelgabriel merged commit 4e1c7a0 into develop Apr 3, 2017
@engelgabriel engelgabriel deleted the fix-oauth branch April 3, 2017 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants