RocketChat / RocketChat/Rocket.Chat

First login over custom OAuth - User missing "user" role for some time

Open
#27,664 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

If a new user logs in the first time over OAuth the user Is not able to login directly. It stays on the login page.
In RocketChat the user gets created instantly what I can see in the Users Settings.
But the user is missing the "user" role.

After a few Minutes the role appers magically mapped to the user. In the debug log it looks like it happens when this job runs:

"level":20,"time":"2022-12-29T12:47:42.923Z","pid":1,"hostname":"rocketchat-8c5cb675d-h9xwl","name":"Callbacks","msg":"Executing callback with id 2fa for hook onValidateLogin"} 
{"level":20,"time":"2022-12-29T12:47:43.060Z","pid":1,"hostname":"rocketchat-8c5cb675d-h9xwl","name":"Callbacks","msg":"Executing callback with id Dqaxxxxa for hook afterValidateLogin"} 

When the role is then assigned - the user can finally login.
2nd factor auth is disabled in the configuration.

Steps to reproduce:
  1. login over OAuth the first time
  2. user gets created but role is missing (see screenshot)
  3. wait
  4. when the role is assigned - login
Expected behavior:
  1. login over OAuth the first time and be logged in ;)
Actual behavior:

RocketChatOauthIssue1

Server Setup Information:
  • Version of Rocket.Chat Server: 5.4.1
  • Operating System: Official RocketChat container image
  • Deployment Method: K8s / Openshift
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: v14.19.3
  • MongoDB Version: 6.0.3
Client Setup Information
  • Browser Version: Chromium 105.0.5195.125
Relevant logs:
"level":20,"time":"2022-12-29T12:47:42.923Z","pid":1,"hostname":"rocketchat-8c5cb675d-h9xwl","name":"Callbacks","msg":"Executing callback with id 2fa for hook onValidateLogin"} 
{"level":20,"time":"2022-12-29T12:47:43.060Z","pid":1,"hostname":"rocketchat-8c5cb675d-h9xwl","name":"Callbacks","msg":"Executing callback with id Dqaxxxxa for hook afterValidateLogin"} 

There are no logs about a failed login - nothing seems wrong beside the missing role :(

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OAuth first-login flow and the onValidateLogin and afterValidateLogin callbacks shown in the logs. Reproduce the first OAuth login and trace when the user role is assigned; done means the new user receives the role and is logged in immediately without waiting.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication, authorization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.