RocketChat / RocketChat/Rocket.Chat

GitHub Enterprise OAuth fails on GHE 3.0.10

Open
#23,030 2 comments 0 reactions 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:

I have trouble configuring GitHub Enterprise OAuth Login with:

  • RocketChat 3.17.1
  • GitHub Enterprise 3.0.10

I have set it up as documented (created an OAuth App in GHE with the RC callback URL, configured the Client ID and Secret in RC).
But it always fails with the following error:

Exception while invoking method 'login' Error: Failed to fetch identity from github_enterprise at https://github.ruv.de/api/v3/user. failed [400] {"message":"Must specify access token via Authorization header","documentation_url":"https://docs.github.com/enterprise/3.0/v3/#oauth2-token-sent-in-a-header"} at CustomOAuth.getIdentity (app/custom-oauth/server/custom_oauth_server.js:197:18) at Object.handleOauthRequest (app/custom-oauth/server/custom_oauth_server.js:206:26) at OAuth._requestHandlers.<computed> (packages/oauth2/oauth2_server.js:10:33) at middleware (packages/oauth/oauth_server.js:170:5) at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40

We have a second RocketChat instance running in our to-be-deprecated K8s cluster which also uses our GHE 3.0.10 for the OAuth login which succeeds without problems. I can not find any differences between my freshly setup RocketChat and the old instance.

Steps to reproduce:
  1. Install GHE 3.0.10
  2. Install RocketChat 3.17.1
  3. Create a GHE Application for RocketChat (with the CallBack URL from RocketChat)
  4. Configure the GHE OAuth Login in RocketChat (with the GHE App Client ID and Secret)
  5. Perform a GitHub Login
Expected behavior:

User authorizes the RocketChat App to get the User Info from GHE. User gets a new account if no account exists yet. User can use RocketChat.

Actual behavior:

User authorizes RocketChat App to get the User Info from GHE. RocketChat fails retrieving the User Info from GHE.

Server Setup Information:
  • Version of Rocket.Chat Server: 3.17.1
  • Operating System: Official Docker Image
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: 1
  • NodeJS Version: v12.22.1
  • MongoDB Version: 3.6.23 / wiredTiger (oplog Enabled)
Client Setup Information
  • Desktop App or Browser Version: both
  • Operating System: Windows 10
Additional context

Log Level set to 2

Relevant logs:

Server:
Exception while invoking method 'login' Error: Failed to fetch identity from github_enterprise at https://github.ruv.de/api/v3/user. failed [400] {"message":"Must specify access token via Authorization header","documentation_url":"https://docs.github.com/enterprise/3.0/v3/#oauth2-token-sent-in-a-header"} at CustomOAuth.getIdentity (app/custom-oauth/server/custom_oauth_server.js:197:18) at Object.handleOauthRequest (app/custom-oauth/server/custom_oauth_server.js:206:26) at OAuth._requestHandlers.<computed> (packages/oauth2/oauth2_server.js:10:33) at middleware (packages/oauth/oauth_server.js:170:5) at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40

Client reports "Internal server error"
{"isClientSafe":true,"error":500,"reason":"Internal server error","message":"Internal server error [500]","errorType":"Meteor.Error"}

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

Inspect app/custom-oauth/server/custom_oauth_server.js around lines 197-206 and the OAuth2 request flow; reproduce with RocketChat 3.17.1 and GHE 3.0.10 using the supplied callback configuration. Done means the GitHub Enterprise identity request succeeds and login creates or authenticates the user without the missing Authorization-header error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.