-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[FIX] Custom Oauth login not working with accessToken #14113
Conversation
@geekgonecrazy I had to add another field for |
I was about to open a similar pull request: 63f6e52
That of cause requires the server to implement that OAuth 2 extension. I will try this pull request and report back, if that allows me to access Rocket.Chat Api with accessToken from my server. Ralf |
Note on introspection.. it for sure will need to be configurable: https://www.oauth.com/oauth2-servers/token-introspection-endpoint/ here they are using /token_info in the rfc they use: /introspect - https://tools.ietf.org/html/rfc7662 Maybe have a setting.. if "" then don't use introspect since the oauth provider probably hasn't implemented it |
Remove some coffeescript console.log that were commented out Make the addHookToProcessUser use the username field from the identity that we picked out
…ack so our BeforeUpdateOrCreateUserFromExternalService is ran in custom oauth
@knrt10 made a few adjustments it now works :) |
This is looking good 👍 i'll give it another pass. @ralfbecker if you get a chance definitely give this a go and see if works for your case as well |
A quick update: this pull request does not fix my issue which Rocket.Chat Api access with an accessToken and custom OAuth. It seems the custom OAuth does NOT get registered in AccessTokenServices, it it's called via the Api. |
@ralfbecker can you specify your process to access the API using token? |
Did you follow this step? I am giving an example for github. You need to go to, admin, Oauth, create a new oauth and just fill the URL endpoint and identity input box, like for github URL is . Now go and create access token from your github account and use it in your request like this curl -H "Content-type:application/json" \
http://localhost:3000/api/v1/login \
-d '{ "serviceName": "yourServiceName", "accessToken": "token","expiresIn": 200 } Also your |
I believe I do exactly the same. Config in Rocket.Chat is like in my README. And I get the exception from here: https://github.com/knrt10/Rocket.Chat/blob/issue14108/app/lib/server/oauth/oauth.js#L31 |
It should work, did you rebased the latest changes? I mean some changes were made quite recently. Let me try once for this |
@ralfbecker Its working, I found the error, even if you set name as curl -H "Content-type:application/json" \
http://localhost:3000/api/v1/login \
-d '{ "serviceName": "egroupware", "accessToken": "token","expiresIn": 200 }' Notice name is My Access token is wrong so error |
That is not the problem, I already use "egroupware" as serviceName. I just verified, that - for some reason - I made a mistake in merging your pull-request. I redo it and let you know. Ralf |
Sure, no problem we need testing for this feature, thank you for helping ✌️ |
Ok, I can make now requests to Rocket.Chat Api with my own servers access-tokens :) I need to check if my pull request #14121 is still necessary and if the refreshToken is used. |
Awesome! Glad you were able to test and get it working! |
Hi, Is it possible to do it now ? I mean, use the rest api with a keycloak jwt token ? Thanks, |
TODO
Closes #14108
cc @geekgonecrazy would you please review