Headscale setup oidc with Authelia not work #533

Closed
opened 2025-12-29 02:19:36 +01:00 by adam · 1 comment
Owner

Originally created by @leeaash on GitHub (Jul 19, 2023).

Bug description

I setup an Authelia for headscale to use oidc, but it seems not to work and reports an error after authentication success.

error log as following
2023-07-19T07:58:27Z ERR src/headscale/oidc.go:307 > Could not exchange code for token error="oauth2: cannot fetch token: 401 Unauthorized\nResponse: {"error":"invalid_client","error_description":"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method)."}"

Environment

  • OS:
  • Headscale version: 0.22.3
  • Tailscale version: 1.44
  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

To Reproduce

Originally created by @leeaash on GitHub (Jul 19, 2023). <!-- Before posting a bug report, discuss the behaviour you are expecting with the Discord community to make sure that it is truly a bug. The issue tracker is not the place to ask for support or how to set up Headscale. Bug reports without the sufficient information will be closed. Headscale is a multinational community across the globe. Our language is English. All bug reports needs to be in English. --> ## Bug description <!-- A clear and concise description of what the bug is. Describe the expected bahavior and how it is currently different. If you are unsure if it is a bug, consider discussing it on our Discord server first. --> I setup an Authelia for headscale to use oidc, but it seems not to work and reports an error after authentication success. error log as following 2023-07-19T07:58:27Z ERR src/headscale/oidc.go:307 > Could not exchange code for token error="oauth2: cannot fetch token: 401 Unauthorized\nResponse: {\"error\":\"invalid_client\",\"error_description\":\"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).\"}" ## Environment <!-- Please add relevant information about your system. For example: - Version of headscale used - Version of tailscale client 1.44 - OS (e.g. Linux, Mac, Cygwin, WSL, etc.) and version - Kernel version - The relevant config parameters you used - Log output --> - OS: - Headscale version: 0.22.3 - Tailscale version: 1.44 <!-- We do not support running Headscale in a container nor behind a (reverse) proxy. If either of these are true for your environment, ask the community in Discord instead of filing a bug report. --> - [x] Headscale is behind a (reverse) proxy - [x] Headscale runs in a container ## To Reproduce <!-- Steps to reproduce the behavior. -->
adam added the bug label 2025-12-29 02:19:36 +01:00
adam closed this issue 2025-12-29 02:19:36 +01:00
Author
Owner

@leeaash commented on GitHub (Jul 21, 2023):

I found the issue, I used different secrets between Authelia and Headscale, my bad.

@leeaash commented on GitHub (Jul 21, 2023): I found the issue, I used different secrets between Authelia and Headscale, my bad.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#533