Netbird - No Identity Providers work ! Keycloak - Login Error: User state: Unauthenticated #709

Open
opened 2025-11-20 05:16:18 -05:00 by saavagebueno · 9 comments
Owner

Originally created by @luckylinux on GitHub (Mar 15, 2024).

Describe the problem
After trying to get Netbird Self Hosted with Authentik and getting weird errors (https://github.com/netbirdio/netbird/issues/1684) and no help so far, I decided to give a try to:

  • Netbird + Zitadel -> This apparently causes some issues (Zitadel related i/o timeout for connection between PostgreSQL and Zitadel-Server, probably cause is 100% CPU usage on my VPS Server and extremely high memory/RAM usage in Zitadel)
  • Netbird + Keycloak -> This results in a "Login Error: User state: Unauthenticated".

Nothing can be extracted from the logs of keycloak nor netbird-management Docker Container.

Looking at https://github.com/netbirdio/netbird/issues/1590, I am also running into the "CORS Missing Allow Origin".

To Reproduce

  1. Setup Keycloak and Netbird according to the current version of https://docs.netbird.io/selfhosted/identity-providers#keycloak, both running behind Traefik Reverse Proxy with Letsencrypt provided TLS Certificates.
  2. Visit https://netbird.MYDOMAIN.TLD
  3. Get Login Error: User state: Unauthenticated

Expected behavior

Netbird working correctly.

Are you using NetBird Cloud?

Netbird self-hosted.

NetBird version

netbird version

NetBird status -d output:

Not sure how to do this:

  • netbird-management container: netbird: command not found
  • netbird-dashboard container: netbird: command not found
  • netbird-signal container: Error: crun: executable file /bin/sh not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
  • netbird-coturn container: netbird: command not found

Screenshots

Additional context

Environment same as in https://github.com/netbirdio/netbird/issues/1684 (Podman 4.9.3).

Originally created by @luckylinux on GitHub (Mar 15, 2024). **Describe the problem** After trying to get Netbird Self Hosted with Authentik and getting weird errors (https://github.com/netbirdio/netbird/issues/1684) and no help so far, I decided to give a try to: - Netbird + Zitadel -> This apparently causes some issues (Zitadel related i/o timeout for connection between PostgreSQL and Zitadel-Server, probably cause is 100% CPU usage on my VPS Server and extremely high memory/RAM usage in Zitadel) - Netbird + Keycloak -> This results in a "Login Error: User state: Unauthenticated". Nothing can be extracted from the logs of `keycloak` nor `netbird-management` Docker Container. Looking at https://github.com/netbirdio/netbird/issues/1590, I am also running into the "CORS Missing Allow Origin". **To Reproduce** 1. Setup Keycloak and Netbird according to the current version of https://docs.netbird.io/selfhosted/identity-providers#keycloak, both running behind Traefik Reverse Proxy with Letsencrypt provided TLS Certificates. 2. Visit https://netbird.MYDOMAIN.TLD 3. Get `Login Error: User state: Unauthenticated` **Expected behavior** Netbird working correctly. **Are you using NetBird Cloud?** Netbird self-hosted. **NetBird version** `netbird version` **NetBird status -d output:** Not sure how to do this: - `netbird-management` container: `netbird: command not found` - `netbird-dashboard` container: `netbird: command not found` - `netbird-signal` container: `Error: crun: executable file `/bin/sh` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found` - `netbird-coturn` container: `netbird: command not found` **Screenshots** **Additional context** Environment same as in https://github.com/netbirdio/netbird/issues/1684 (Podman 4.9.3).
saavagebueno added the waiting-feedbackidpkeycloakself-hostinggetting-started labels 2025-11-20 05:16:18 -05:00
Author
Owner

@mlsmaycon commented on GitHub (Mar 17, 2024):

hello @luckylinux can you share logs from the following containers:

dashboard:

docker compose logs dashboard

management

docker compose logs management

Can you also share the content of your setup.env? you can mask your domain names, and client IDs, just make sure your are using the same masking value for the same real values.

@mlsmaycon commented on GitHub (Mar 17, 2024): hello @luckylinux can you share logs from the following containers: dashboard: ```shell docker compose logs dashboard ``` management ```shell docker compose logs management ``` Can you also share the content of your setup.env? you can mask your domain names, and client IDs, just make sure your are using the same masking value for the same real values.
Author
Owner

@luckylinux commented on GitHub (Mar 17, 2024):

Sure @mlsmaycon

I had to adjust a bit the command though since I am using Podman and not Docker ...

podman logs netbird-dashboard
podman_logs_netbird-dashboard.log

podman logs netbird-management

podman_logs_netbird-management.log

setup.env
setup.env.txt

@luckylinux commented on GitHub (Mar 17, 2024): Sure @mlsmaycon I had to adjust a bit the command though since I am using Podman and not Docker ... `podman logs netbird-dashboard` [podman_logs_netbird-dashboard.log](https://github.com/netbirdio/netbird/files/14628452/podman_logs_netbird-dashboard.log) `podman logs netbird-management` [podman_logs_netbird-management.log](https://github.com/netbirdio/netbird/files/14628453/podman_logs_netbird-management.log) `setup.env` [setup.env.txt](https://github.com/netbirdio/netbird/files/14628459/setup.env.txt)
Author
Owner

@Zaryu commented on GitHub (May 3, 2024):

Are there any news on this? Also unauthenticated running via keycloak.
Also getting the same CORS error as above. All set up like in the documentation mentioned above.

       content.js:364 getEmbedInfo
       content.js:425 OEMBED https://netbird.MYDOMAIN.tld/?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback
       2731-e746de7d02695f25.js:1 Checking to see if there is an authorization response to be delivered.
       2731-e746de7d02695f25.js:1 Potential authorization request  https://netbird.MYDOMAIN.tld/ Object EmabodHrAU fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff undefined
       2731-e746de7d02695f25.js:1 Delivering authorization response
       /?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback:1 Access to fetch at 'https://auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token' from origin 'https://netbird.MYDOMAIN.tld' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
       auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token:1 

 
       Failed to load resource: net::ERR_FAILED


       2731-e746de7d02695f25.js:1 
  
        
       
       Uncaught (in promise) TypeError: Failed to fetch
    at FetchRequestor.xhr (2731-e746de7d02695f25.js:1:82495)
    at BaseTokenRequestHandler.performTokenRequest (2731-e746de7d02695f25.js:1:79114)
    at AuthorizationNotifier.listener (2731-e746de7d02695f25.js:1:56541)
    at AuthorizationNotifier.onAuthorizationComplete (2731-e746de7d02695f25.js:1:65206)
    at 2731-e746de7d02695f25.js:1:66271
@Zaryu commented on GitHub (May 3, 2024): Are there any news on this? Also unauthenticated running via keycloak. Also getting the same CORS error as above. All set up like in the documentation mentioned above. ``` content.js:364 getEmbedInfo content.js:425 OEMBED https://netbird.MYDOMAIN.tld/?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback 2731-e746de7d02695f25.js:1 Checking to see if there is an authorization response to be delivered. 2731-e746de7d02695f25.js:1 Potential authorization request https://netbird.MYDOMAIN.tld/ Object EmabodHrAU fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff undefined 2731-e746de7d02695f25.js:1 Delivering authorization response /?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback:1 Access to fetch at 'https://auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token' from origin 'https://netbird.MYDOMAIN.tld' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token:1 Failed to load resource: net::ERR_FAILED 2731-e746de7d02695f25.js:1 Uncaught (in promise) TypeError: Failed to fetch at FetchRequestor.xhr (2731-e746de7d02695f25.js:1:82495) at BaseTokenRequestHandler.performTokenRequest (2731-e746de7d02695f25.js:1:79114) at AuthorizationNotifier.listener (2731-e746de7d02695f25.js:1:56541) at AuthorizationNotifier.onAuthorizationComplete (2731-e746de7d02695f25.js:1:65206) at 2731-e746de7d02695f25.js:1:66271
Author
Owner

@Zaryu commented on GitHub (May 15, 2024):

Are there any news on this? Also unauthenticated running via keycloak. Also getting the same CORS error as above. All set up like in the documentation mentioned above.

       content.js:364 getEmbedInfo
       content.js:425 OEMBED https://netbird.MYDOMAIN.tld/?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback
       2731-e746de7d02695f25.js:1 Checking to see if there is an authorization response to be delivered.
       2731-e746de7d02695f25.js:1 Potential authorization request  https://netbird.MYDOMAIN.tld/ Object EmabodHrAU fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff undefined
       2731-e746de7d02695f25.js:1 Delivering authorization response
       /?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback:1 Access to fetch at 'https://auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token' from origin 'https://netbird.MYDOMAIN.tld' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
       auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token:1 

 
       Failed to load resource: net::ERR_FAILED


       2731-e746de7d02695f25.js:1 
  
        
       
       Uncaught (in promise) TypeError: Failed to fetch
    at FetchRequestor.xhr (2731-e746de7d02695f25.js:1:82495)
    at BaseTokenRequestHandler.performTokenRequest (2731-e746de7d02695f25.js:1:79114)
    at AuthorizationNotifier.listener (2731-e746de7d02695f25.js:1:56541)
    at AuthorizationNotifier.onAuthorizationComplete (2731-e746de7d02695f25.js:1:65206)
    at 2731-e746de7d02695f25.js:1:66271

My problem is solved. The issue was that the user somehow hasn't had the default-roles-apps role, and with that no uma_authorization and no offline_access roles. Put the role back an it works.

@Zaryu commented on GitHub (May 15, 2024): > Are there any news on this? Also unauthenticated running via keycloak. Also getting the same CORS error as above. All set up like in the documentation mentioned above. > > ``` > content.js:364 getEmbedInfo > content.js:425 OEMBED https://netbird.MYDOMAIN.tld/?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback > 2731-e746de7d02695f25.js:1 Checking to see if there is an authorization response to be delivered. > 2731-e746de7d02695f25.js:1 Potential authorization request https://netbird.MYDOMAIN.tld/ Object EmabodHrAU fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff undefined > 2731-e746de7d02695f25.js:1 Delivering authorization response > /?state=EmabodHrAU&session_state=bf19a860-aa59-40d2-847a-6e70c172b05b&iss=https%3A%2F%2Fauth.MYDOMAIN.tld%2Frealms%2FMYREALM&code=fe9d32ef-9d35-4c23-8350-598ac78cf784.bf19a860-aa59-40d2-847a-6e70c172b05b.b7a2ec9a-1fc9-4850-a12c-d5ee66d01aff#callback:1 Access to fetch at 'https://auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token' from origin 'https://netbird.MYDOMAIN.tld' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. > auth.MYDOMAIN.tld/realms/MYREALM/protocol/openid-connect/token:1 > > > Failed to load resource: net::ERR_FAILED > > > 2731-e746de7d02695f25.js:1 > > > > Uncaught (in promise) TypeError: Failed to fetch > at FetchRequestor.xhr (2731-e746de7d02695f25.js:1:82495) > at BaseTokenRequestHandler.performTokenRequest (2731-e746de7d02695f25.js:1:79114) > at AuthorizationNotifier.listener (2731-e746de7d02695f25.js:1:56541) > at AuthorizationNotifier.onAuthorizationComplete (2731-e746de7d02695f25.js:1:65206) > at 2731-e746de7d02695f25.js:1:66271 > ``` My problem is solved. The issue was that the user somehow hasn't had the default-roles-apps role, and with that no uma_authorization and no offline_access roles. Put the role back an it works.
Author
Owner

@luckylinux commented on GitHub (Sep 15, 2024):

@mlsmaycon : any News on this ? It's really unfortunate I'm not getting anything working.

At least the Webpage should show something useful IMHO, not just crash the entire thing (and the Logs don't really tell much).

@luckylinux commented on GitHub (Sep 15, 2024): @mlsmaycon : any News on this ? It's really unfortunate I'm not getting anything working. At least the Webpage should show something useful IMHO, not just crash the entire thing (and the Logs don't really tell much).
Author
Owner

@luckylinux commented on GitHub (Sep 15, 2024):

I just noticed there might be something related to Traefik Reverse Proxy going on ...

At the moment I only had the Dashboard reverse Proxy, but trying a Netbird Installation from Scratch using ./configure.sh I get these Warnings:

The following forwards have to be setup:
- https://netbird.MYDOMAIN.TLD:443 -http-> dashboard:80
- https://netbird.MYDOMAIN.TLD:443/api -http-> management:443
- https://netbird.MYDOMAIN.TLD:443/management.ManagementService/ -grpc-> management:443
- https://netbird.MYDOMAIN.TLD:443/signalexchange.SignalExchange/ -grpc-> signal:80
You most likely also have to change NETBIRD_MGMT_API_ENDPOINT in base.setup.env and port-mappings in docker-compose.yml.tmpl and rerun this script.
 The target of the forwards depends on your setup. Beware of the gRPC protocol instead of http for management and signal!
You are also free to remove any occurrences of the Letsencrypt-volume netbird-letsencrypt

@luckylinux commented on GitHub (Sep 15, 2024): I just noticed there might be something related to Traefik Reverse Proxy going on ... At the moment I only had the Dashboard reverse Proxy, but trying a Netbird Installation from Scratch using `./configure.sh` I get these Warnings: ``` The following forwards have to be setup: - https://netbird.MYDOMAIN.TLD:443 -http-> dashboard:80 - https://netbird.MYDOMAIN.TLD:443/api -http-> management:443 - https://netbird.MYDOMAIN.TLD:443/management.ManagementService/ -grpc-> management:443 - https://netbird.MYDOMAIN.TLD:443/signalexchange.SignalExchange/ -grpc-> signal:80 You most likely also have to change NETBIRD_MGMT_API_ENDPOINT in base.setup.env and port-mappings in docker-compose.yml.tmpl and rerun this script. The target of the forwards depends on your setup. Beware of the gRPC protocol instead of http for management and signal! You are also free to remove any occurrences of the Letsencrypt-volume netbird-letsencrypt ```
Author
Owner

@nazarewk commented on GitHub (Apr 28, 2025):

Hello @luckylinux,

We're currently reviewing our open issues and would like to verify if this problem still exists in the latest NetBird version.

Could you please confirm if the issue is still there?

We may close this issue temporarily if we don't hear back from you within 2 weeks, but feel free to reopen it with updated information.

Thanks for your contribution to improving the project!

@nazarewk commented on GitHub (Apr 28, 2025): Hello @luckylinux, We're currently reviewing our open issues and would like to verify if this problem still exists in the [latest NetBird version](https://github.com/netbirdio/netbird/releases). Could you please confirm if the issue is still there? We may close this issue temporarily if we don't hear back from you within **2 weeks**, but feel free to reopen it with updated information. Thanks for your contribution to improving the project!
Author
Owner

@luckylinux commented on GitHub (Apr 28, 2025):

@nazarewk Not sure I'll have Time in the next 2 Weeks to troubleshoot this 😥.

I had to switch to "pure" Wireguard since I was stuck on getting this to work in 2024 ...

@luckylinux commented on GitHub (Apr 28, 2025): @nazarewk Not sure I'll have Time in the next 2 Weeks to troubleshoot this 😥. I had to switch to "pure" Wireguard since I was stuck on getting this to work in 2024 ...
Author
Owner

@jonathanschlitt commented on GitHub (Aug 22, 2025):

The Problem still exists for me with Traefik, Keycloak and Netbird in the latent version. I also commented it with my work acount on another open issue.

https://github.com/netbirdio/netbird/issues/2442#issuecomment-3200070065

@jonathanschlitt commented on GitHub (Aug 22, 2025): The Problem still exists for me with Traefik, Keycloak and Netbird in the latent version. I also commented it with my work acount on another open issue. https://github.com/netbirdio/netbird/issues/2442#issuecomment-3200070065
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#709