From de1361c20e8f9fda39206c0dcf3f21de5f8a71cf Mon Sep 17 00:00:00 2001 From: F04C Date: Wed, 7 Jan 2026 15:40:53 +0800 Subject: [PATCH] fixed allowedRedirectURI --- handlers/redirect.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/handlers/redirect.go b/handlers/redirect.go index 60fe2c8..7d77167 100644 --- a/handlers/redirect.go +++ b/handlers/redirect.go @@ -8,16 +8,26 @@ import ( func IsAllowedRedirectURI(uri string) bool { allowedRedirectURIsEnv := os.Getenv("ALLOWED_REDIRECT_URIS") + log.Print("Checking redirect URI: ", uri) + log.Print("Allowed Redirect URIs (raw): ", allowedRedirectURIsEnv) + if allowedRedirectURIsEnv == "" { + log.Print("ERROR: ALLOWED_REDIRECT_URIS environment variable is empty") return false } allowedRedirectURIs := strings.Split(allowedRedirectURIsEnv, ",") - for _, allowed := range allowedRedirectURIs { - if uri == strings.TrimSpace(allowed) { + log.Print("Parsed allowed URIs count: ", len(allowedRedirectURIs)) + + for i, allowed := range allowedRedirectURIs { + trimmed := strings.TrimSpace(allowed) + log.Printf(" [%d] Comparing '%s' with '%s'", i, uri, trimmed) + if uri == trimmed { + log.Print("✓ Redirect URI allowed: ", uri) return true } } - log.Print("Redirect URI not allowed: ", uri) + + log.Print("✗ Redirect URI not allowed: ", uri) return false }