Closed
Description
Describe the bug
Can't get Oauth working with self-hosted gitpod and gitlab instance.
GitPod (version: 0.6.0-beta1): self-hosted deployment in kubernetes
GitLab: self-hosted premium
Additional information
Helm values
# Copyright (c) 2020 TypeFox GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
# This field must be set to your domain name. Leaving it set to its default value will result in
# a non-functional installation.
hostname: {{ gitpod_hostname }}
ingressMode: hosts
# If you have a static IP that your domain resolves to, set it here.
# Leaving this field set to its default value is fine. Kubernetes will assign you an IP address
# during deployment.
components:
proxy:
loadBalancerIP: {{ gitpod_proxy_loadbalancer_ip }}
workspace:
template:
default:
spec:
dnsConfig:
nameservers:
- 10.26.103.10
- 10.26.103.11
dnsPolicy: ClusterFirst
# Gitpod needs at least one auth provider to allow users to log in.
# The auth providers below are examples only. Please change/remove them to fit your installation.
authProviders:
- id: "{{ gitpod_authProviders_gitlab_id }}"
host: "{{ gitpod_authProviders_gitlab_host }}"
protocol: "https"
type: "GitLab"
oauth:
clientId: "{{ gitpod_authProviders_gitlab_oauth_client_id }}"
clientSecret: "{{ gitpod_authProviders_gitlab_oauth_client_secret }}"
callBackUrl: "https://{{ gitpod_hostname }}/auth/{{ gitpod_authProviders_gitlab_host }}/callback"
settingsUrl: "https://{{ gitpod_authProviders_gitlab_host }}/profile/applications"
# RBAC is enabled by default. If your cluster does not use RBAC, set this flag to false so that
# we do not attempt to install PodSecurityPolicies and the likes.
installPodSecurityPolicies: true
#certificatesSecret: {}
certificatesSecret:
secretName: proxy-config-certificates
GitPod Server Logs
{
"component": "server",
"severity": "INFO",
"time": "2020-12-22T09:15:13.772Z",
"environment": "production",
"region": "local",
"message": "Request getFeaturedRepositories unsuccessful: 401/\"User is not authenticated. Please login.\"",
"payload": {
"method": "getFeaturedRepositories",
"args": [
null,
{
"_isCancelled": false
}
]
}
}
{
"component": "server",
"severity": "INFO",
"time": "2020-12-22T09:15:15.300Z",
"environment": "production",
"region": "local",
"context": {
"sessionId": "c67e1fc1-339d-4fbc-b170-328dc0e0645f"
},
"message": "(Auth) User started the login process",
"payload": {
"login-flow": true,
"clientInfo": {
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041",
"fingerprint": "36489166f56651e48e01d3a6c34ae05e7f770abd2329a1aed83832dd0530f86c"
}
}
}
{
"component": "server",
"severity": "INFO",
"time": "2020-12-22T09:15:18.746Z",
"environment": "production",
"region": "local",
"message": "Auth Provider Callback. Path: /auth/gitlab.garrison.local/callback"
}
{
"component": "server",
"severity": "INFO",
"time": "2020-12-22T09:15:18.746Z",
"environment": "production",
"region": "local",
"context": {},
"message": "(Auth-With-gitlab.garrison.local) OAuth2 callback call. ",
"payload": {
"clientInfo": {
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041",
"fingerprint": "36489166f56651e48e01d3a6c34ae05e7f770abd2329a1aed83832dd0530f86c"
},
"authProviderId": "garrison-gitlab",
"requestUrl": "/auth/gitlab.garrison.local/callback?code=1bf718b9ef0325287fd89ae7fdb3bf2b045942e2135d6caeaaf67be8ddfbb8fb"
}
}
{
"@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
"serviceContext": {
"service": "server",
"version": "0.6.0-beta1"
},
"stack_trace": "InternalOAuthError: Failed to obtain access token\n at GenericOAuth2Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:379:17)\n at /app/node_modules/passport-oauth2/lib/strategy.js:166:45\n at patchedCallback (/app/node_modules/@gitpod/server/dist/src/auth/generic-auth-provider.js:837:28)\n at /app/node_modules/oauth/lib/oauth2.js:191:18\n at ClientRequest.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:162:5)\n at ClientRequest.emit (events.js:315:20)\n at ClientRequest.EventEmitter.emit (domain.js:483:12)\n at TLSSocket.socketErrorListener (_http_client.js:426:9)\n at TLSSocket.emit (events.js:315:20)\n at TLSSocket.EventEmitter.emit (domain.js:483:12)\n at emitErrorNT (internal/streams/destroy.js:92:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)",
"component": "server",
"severity": "ERROR",
"time": "2020-12-22T09:15:18.787Z",
"environment": "production",
"region": "local",
"context": {},
"message": "(Auth-With-gitlab.garrison.local) Redirect to /sorry from verify callback",
"error": "InternalOAuthError: Failed to obtain access token\n at GenericOAuth2Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:379:17)\n at /app/node_modules/passport-oauth2/lib/strategy.js:166:45\n at patchedCallback (/app/node_modules/@gitpod/server/dist/src/auth/generic-auth-provider.js:837:28)\n at /app/node_modules/oauth/lib/oauth2.js:191:18\n at ClientRequest.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:162:5)\n at ClientRequest.emit (events.js:315:20)\n at ClientRequest.EventEmitter.emit (domain.js:483:12)\n at TLSSocket.socketErrorListener (_http_client.js:426:9)\n at TLSSocket.emit (events.js:315:20)\n at TLSSocket.EventEmitter.emit (domain.js:483:12)\n at emitErrorNT (internal/streams/destroy.js:92:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)",
"payload": {
"authFlow": {
"host": "gitlab.garrison.local",
"returnTo": "https://gitpod.garrison.local/workspaces/",
"returnToAfterTos": "https://gitpod.garrison.local/api/login/?returnTo=https%3A%2F%2Fgitpod.garrison.local%2Fworkspaces%2F&host=gitlab.garrison.local"
},
"clientInfo": {
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041",
"fingerprint": "36489166f56651e48e01d3a6c34ae05e7f770abd2329a1aed83832dd0530f86c"
},
"authProviderId": "garrison-gitlab",
"err": "InternalOAuthError: Failed to obtain access token\n at GenericOAuth2Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:379:17)\n at /app/node_modules/passport-oauth2/lib/strategy.js:166:45\n at patchedCallback (/app/node_modules/@gitpod/server/dist/src/auth/generic-auth-provider.js:837:28)\n at /app/node_modules/oauth/lib/oauth2.js:191:18\n at ClientRequest.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:162:5)\n at ClientRequest.emit (events.js:315:20)\n at ClientRequest.EventEmitter.emit (domain.js:483:12)\n at TLSSocket.socketErrorListener (_http_client.js:426:9)\n at TLSSocket.emit (events.js:315:20)\n at TLSSocket.EventEmitter.emit (domain.js:483:12)\n at emitErrorNT (internal/streams/destroy.js:92:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)"
}
}
{
"component": "server",
"severity": "INFO",
"time": "2020-12-22T09:15:19.101Z",
"environment": "production",
"region": "local",
"message": "Request getLoggedInUser unsuccessful: 401/\"User is not authenticated. Please login.\"",
"payload": {
"method": "getLoggedInUser",
"args": [
null,
{
"_isCancelled": false
}
]
}
}
GitPod Server Error
InternalOAuthError: Failed to obtain access token
at GenericOAuth2Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:379:17)
at /app/node_modules/passport-oauth2/lib/strategy.js:166:45
at patchedCallback (/app/node_modules/@gitpod/server/dist/src/auth/generic-auth-provider.js:837:28)
at /app/node_modules/oauth/lib/oauth2.js:191:18
at ClientRequest.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:162:5)
at ClientRequest.emit (events.js:315:20)
at ClientRequest.EventEmitter.emit (domain.js:483:12)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:315:20)
at TLSSocket.EventEmitter.emit (domain.js:483:12)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)