Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Rocket Chat Authentication Instructions? #2572

Closed
HiveMindNet opened this issue Oct 12, 2020 · 13 comments
Closed

Rocket Chat Authentication Instructions? #2572

HiveMindNet opened this issue Oct 12, 2020 · 13 comments

Comments

@HiveMindNet
Copy link

Question
Trying to use the Rocket Chat auth but no documentation anywhere to help me test i.

Host Info (please complete the following information):
OS: Latest Docker
Wiki.js version: 2.5.159
Database engine: Latest Docker PG_VERSION 11.8

Can someone please either point bee to some docs or help me understand where I get or set up the 'Client ID' and 'Client Secret' in my Rocket admin? Also, will this integration still work if I'm actually using iFrame auth on my Rocket instance? (Rocket authenticates from our other main website).

Any pointers or docs would be greatly appreciated :)

Thank you in advance.

@HiveMindNet HiveMindNet changed the title Rocke Chat Authentication Issue Rocket Chat Authentication Instructions? Oct 13, 2020
@HiveMindNet
Copy link
Author

Has anyone got this working at all?

@gatesry
Copy link

gatesry commented Oct 27, 2020

Have you looked at these docs https://docs.rocket.chat/guides/administrator-guides/authentication

Also check in the wiki code, it has an auth file that breaks down the strategy. I belive it's OAuth

@HiveMindNet
Copy link
Author

HiveMindNet commented Oct 28, 2020 via email

@HiveMindNet
Copy link
Author

HiveMindNet commented Nov 8, 2020

Has Anyone managed to get Rocket Chat Authentication working? If so could you please share how you set it up?

@erikvanberkum
Copy link

i got it installed to the point that i get the following error in wiki.js

Oops, something went wrong...
Missing or invalid email address from profile

image

@deg0nz
Copy link
Contributor

deg0nz commented Feb 21, 2021

I have the exact same issue.

I wanted to debug this further, but I can't find any method to increase the log level. I found no docs about some log level environment variable and mounting config.yml with increased loglevel seems not to work as mentioned in #2497.

What I found was, that the request to Wiki.js's auth callback url returns a HTTP 500.

@deg0nz
Copy link
Contributor

deg0nz commented Feb 22, 2021

Okay, I digged into this a little and found the following:

Wiki.js's oAuth module requests to Rocket.Chat API via /api/v1/me and then extracts user information from the response. Wiki.js accesses usr.email directly from the response object, but according to the Rocket.Chat API docs, the user's emails are stored in an array called emails.

This could be the reason of the error because then the email field for the Wiki.js callback function would be empty, since it does not exist in the response.

This should be a small fix. I will try to setup a dev environment for Wiki.js in the next days and send a PR if my findings are true.

Edit: wording

@deg0nz
Copy link
Contributor

deg0nz commented Feb 22, 2021

Also, @HiveMindNet's questions seem not to be answered yet.

Can someone please either point bee to some docs or help me understand where I get or set up the 'Client ID' and 'Client Secret' in my Rocket admin? Also, will this integration still work if I'm actually using iFrame auth on my Rocket instance? (Rocket authenticates from our other main website).

Client ID and Client Secret are shown in Rocket.Chat's UI after creating the OAuth entry in Rocket.Chat admin UI.

I can't really answer the iFrame part, but there is an iFrame guide for Rocket.Chat. Maybe it helps: https://docs.rocket.chat/guides/developer/iframe-integration

@HiveMindNet
Copy link
Author

Thanks @deg0nz - I don't need help with iFrame - that's all been working for ages; I just added for info purposes. The real question as you say still stands. Where to set or get the 'Client ID' and 'Client Secret' from.

@HiveMindNet
Copy link
Author

On another forum, guys on there were saying that Rocket has no way of providing authentication services as a server. Which sounds like it contradicts the very purpose of this Wiki authentication strategy.

@deg0nz
Copy link
Contributor

deg0nz commented Feb 22, 2021

Okay, as I assumed, the problem was the usr.email property. I was able to authenticate with my Rocket.Chat instance and the fix I added in PR #3122. So Rocket.Chat as an OAuth server is definitely working.

I'm using Rocket.Chat 3.11.1

@HiveMindNet answers to your questions as follows:

The real question as you say still stands. Where to set or get the 'Client ID' and 'Client Secret' from.

This is a little bit counter intuitive...

Here is how you access the needed credentials in Rocket.Chat:

Create new OAuth Application in Rocket.Chat via Administration -> OAuth Apps

Screenshot 2021-02-22 at 17 48 22

After that, you can access the created OAuth Application and read out Client ID and Client Secret:

Screenshot 2021-02-22 at 18 12 17
Note: Don't forget to turn on your newly created OAuth application in Rocket.Chat! A newly added OAuth app is disabled by default. There is a small on/off switch at the top of the page.

Add the credentials to the corresponding fields in Wiki.js configuration.

Until PR #3122 is merged, you will get the error mentioned by @erikvanberkum though...

Edit: wording for more clarity and typos

@erikvanberkum
Copy link

erikvanberkum commented Feb 23, 2021

The fix works well, I am able to login via Rocket.Chat 3.11.0.
Dont forget to set your user permissions in Wiki.JS

image

@HiveMindNet
Copy link
Author

Thanks to @deg0nz and @erikvanberkum - I was so excited to see this progress today but then I tried and I don't think this has fixed the issue for me. I made the changes in the PR on Wiki.js but it's still failing with the following;

Screenshot 2021-02-23 at 10 53 36

I'm not sure about what to expect if I simply add the rocket myaddress.com/oauth/token url to a browser - maybe it's expecting something or maybe that's my issue as I get 'Internal Server Error' on that URL :(

Does this look like it could be on the Rocket end now for me? Or are we still having problems with this Wiki auth?

I double checked all were enabled on rocket and wiki and it goes as far as having rocket ask to grant permission to Wiki.js - it's after I grant the permission that I get this fail to obtain the access token.

Again, any help is very much appreciated :)

@NGPixel NGPixel closed this as completed Mar 21, 2021
@requarks requarks locked and limited conversation to collaborators Mar 21, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants