Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Added oauth2 userinfo endpoint #6554

Merged
merged 2 commits into from
Apr 3, 2017
Merged

[New] Added oauth2 userinfo endpoint #6554

merged 2 commits into from
Apr 3, 2017

Conversation

geekgonecrazy
Copy link
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
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
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
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
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