From c7cea9ef16faa67959a7500be2e31e6c3e838a5c Mon Sep 17 00:00:00 2001
From: Juan Font Alonso <juanfontalonso@gmail.com>
Date: Sun, 14 Aug 2022 03:07:28 +0200
Subject: [PATCH] updated paths

---
 noise_api.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/noise_api.go b/noise_api.go
index 475e602..4bc28fc 100644
--- a/noise_api.go
+++ b/noise_api.go
@@ -412,10 +412,10 @@ func (h *Headscale) handleNoiseNodeExpired(
 
 	if h.cfg.OIDC.Issuer != "" {
 		resp.AuthURL = fmt.Sprintf("%s/oidc/register/%s",
-			strings.TrimSuffix(h.cfg.ServerURL, "/"), machine.NodeKey)
+			strings.TrimSuffix(h.cfg.ServerURL, "/"), NodePublicKeyStripPrefix(registerRequest.NodeKey))
 	} else {
-		resp.AuthURL = fmt.Sprintf("%s/register?key=%s",
-			strings.TrimSuffix(h.cfg.ServerURL, "/"), machine.NodeKey)
+		resp.AuthURL = fmt.Sprintf("%s/register/%s",
+			strings.TrimSuffix(h.cfg.ServerURL, "/"), NodePublicKeyStripPrefix(registerRequest.NodeKey))
 	}
 
 	machineRegistrations.WithLabelValues("reauth", "web", "success", machine.Namespace.Name).