Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Can't login with Auth0

Open GabrielSieben opened this issue 9 years ago • 14 comments

Description:

I set up a OAuth thing with http://auth0.com/ but I can't sign in without it providing a server error.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.58.4
  • Operating System: Ubuntu 16.04.3
  • Deployment Method(snap/docker/tar/etc): snap
  • Number of Running Instances: 1

OAuth Settings

Enabled = Yes Token Path = /oauth/token Identity Path = /userinfo Authorize Path = /authorize Token Sent Via = header Scope = (blank) Login Style = Popup

Relevant logs:

I20171014-22:03:42.724(0) Exception while invoking method 'login' SyntaxError: Unexpected token < at Object.parse (native) at CustomOAuth.getAccessToken (/snap/rocketchat-server/1142/programs/server/packages/rocketchat_custom-oauth.js:166:17) at Object.handleOauthRequest (/snap/rocketchat-server/1142/programs/server/packages/rocketchat_custom-oauth.js:224:28) at OAuth._requestHandlers.(anonymous function) (packages/oauth2.js:27:31) at middleware (packages/oauth.js:203:5) at packages/oauth.js:176:5

GabrielSieben avatar Oct 14 '17 22:10 GabrielSieben

Scope should be filled. (Per RFC 6749)

Lawri-van-Buel avatar Oct 16 '17 17:10 Lawri-van-Buel

Also read up on what each path should be.

Lawri-van-Buel avatar Oct 16 '17 17:10 Lawri-van-Buel

Scope = openid (Still doesn't change a thing)

Each path is set to exactly (For each) what they should be.

GabrielSieben avatar Oct 16 '17 18:10 GabrielSieben

Do the oauth login by hand and verify its right.

Lawri-van-Buel avatar Oct 17 '17 00:10 Lawri-van-Buel

I have used other services such as Auth0.com correctly, but I actually set up a Gitea (fork of Gogs) server using the same information successfully.

GabrielSieben avatar Oct 17 '17 14:10 GabrielSieben

set the scope to: openid profile

ToniIltanen avatar Oct 25 '17 10:10 ToniIltanen

You need to adjust your settings to:

Enabled = Yes URL = https://ACCOUNTNAME.auth0.com/ Token Path = oauth/token Identity Path = userinfo Authorize Path = authorize Token Sent Via = Payload Login Style = Popup Scope = openid profile email Username field = LEAVE BLANK

Its important you have / at the end of the url field. Without it you will need to add a / to the beginning for the Token, Identity Path, and Authorize fields

That should resolve the issue. Using those settings works for me.

[Updated 5/30/2018]

707eric avatar Nov 02 '17 21:11 707eric

Also at the top of the setup screen in Rocket Chat you will see a message

"When setting up your OAuth Provider, you'll have to inform a Callback URL. Use " followed by the URL to use. You will need to add that URL in Auth0 in the box for "Allowed Callback URLs:" and you will need to make sure your site is using SSL.

707eric avatar Nov 02 '17 21:11 707eric

@707eric

Is there a way to use the username field?

Unbelievably, IT TOTALLY WORKED!!! YES!!!

GabrielSieben avatar Nov 02 '17 22:11 GabrielSieben

Glad it worked for you!

I'm still trying to figure out the Username field as well. I have tried a few things like email, username, user_id but so far no dice.

707eric avatar Nov 02 '17 22:11 707eric

Did you all get merging of existing e-mail accounts working for this?

simonv3 avatar May 30 '18 21:05 simonv3

I updated my last post with the current settings which seem to do everything I needed.

707eric avatar May 30 '18 21:05 707eric

Further updates for those with Auth0 and Rocket.Chat: I managed to get usernames, emails, and profile images to work! This means that it is now (almost) a fully-supported OAuth integration, and no longer has these missing bits (like missing emails, etc)!

To do this, use the following settings (some are copied from above): Enabled = Yes URL = https://ACCOUNTNAME.auth0.com/ Token Path = oauth/token Identity Path = userinfo Authorize Path = authorize Token Sent Via = Payload Login Style = Popup Scope = openid profile email

My settings: Username field = nickname Name field = name Avatar field = picture

GabrielSieben avatar Oct 15 '19 01:10 GabrielSieben

Merging of existing email accounts also works with the above settings @707eric @simonv3

GabrielSieben avatar Oct 15 '19 01:10 GabrielSieben