Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] OIDC Register/Login Page Opens Twice #2441

Closed
4 tasks done
GoodiesHQ opened this issue Feb 23, 2025 · 8 comments · Fixed by #2445
Closed
4 tasks done

[Bug] OIDC Register/Login Page Opens Twice #2441

GoodiesHQ opened this issue Feb 23, 2025 · 8 comments · Fixed by #2445
Labels
bug Something isn't working

Comments

@GoodiesHQ
Copy link

GoodiesHQ commented Feb 23, 2025

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I noticed that, since upgrading to version 0.25, when I authenticate to my OIDC provider, it will open the login page with the /register/... URL twice. The first time, it redirects me to my OIDC provider as expected, and then successfully authenticating results in a page which shows:

Image

And then immediately afterwards, a new /register/... URL opens again (different identifier than the previous one) which redirects me to my OIDC provider for a second time. Another successfully authentication is required, which then shows the message:

Image

Only the first page is required. If I simply close the second page, it will work just fine. The second page seems to be fully redundant.

Expected Behavior

It's expected that only one register URL should be opened during the first authentication, and then one URL should open for re-authentication. Instead, I'm getting both "authenticated" and "re-authenticated" messages for both the first and subsequent authentications.

I opened this bug report because it is:

  1. Confusing to my users, and
  2. If the public domain is part of split-brain DNS with the internal domain, it can cause a "network changed" error message.

Steps To Reproduce

  1. Use HeadScale version 0.25
  2. Set up an OIDC provider

Environment

- OS: Linux (Docker image)
- Headscale version: 0.25.0
- Tailscale version: 1.80.0/1.80.2

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

No response

@GoodiesHQ GoodiesHQ added the bug Something isn't working label Feb 23, 2025
@kradalby
Copy link
Collaborator

Does it seem like the second register url is opened by the Client in the cli/UI or by a redirect from "Signed in via your OIDC provider" page?

I am trying to figure out how I can replicate this in a test.

@kradalby
Copy link
Collaborator

Is this happening in both GUI and CLI clients?

@GoodiesHQ
Copy link
Author

@kradalby good question. Until now, I only tested it using the GUI. Upon first registration and then manually expiring the node through the API and getting the popup:

Image

Using the CLI I can confirm that this command brought the same behavior, and it does in fact show both URLs in the terminal:

C:\>tailscale up --login-server=https://headscale.example.com --reset --unattended --accept-dns --accept-routes

To authenticate, visit:

        https://headscale.example.com/register/3oYCOZYA2zZmGB4PQ7aHBaMi


To authenticate, visit:

        https://headscale.example.com/register/dv1l2k5FackOYl-7-V3mSd_E

Success.

@GoodiesHQ
Copy link
Author

In fact, I can even confirm that the second URL and the "Success." message gets printed even before the second URL has even loaded in my browser. I can freely close the second URL and it will still successfully log me in and print Success.

For what it's worth, I'm using Micrsoft 365/Entra as my IdP.

@oneingan
Copy link

Same behavior for me with Entra IdP

@kradalby
Copy link
Collaborator

I wondered if this was happening in the tests and they passed because we just took the first URL and ignored the second, so I hardened that over in #2445, but it doesnt seem like it is the case.

I am unable to reproduce it locally with our test infra, I wonder if it applies to other IdPs or if it is a Entra thing.

@nblock
Copy link
Collaborator

nblock commented Feb 24, 2025

I am unable to reproduce it locally with our test infra, I wonder if it applies to other IdPs or if it is a Entra thing.

I've seen this with Keycloak, too. At first, there is only one URL visible. As soon as the login with Keycloak is successful, the second link is printed.

@GoodiesHQ
Copy link
Author

I can confirm that this is fixed! Thank you @kradalby :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants