fixed allowedRedirectURI

This commit is contained in:
2026-01-07 15:40:53 +08:00
parent 2f1debaa96
commit de1361c20e
+13 -3
View File
@@ -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
}