isLoopbackRedirect reports whether a full redirect_uri is an http loopback URL (http://localhost[:port]/…, http://127.0.0.1[:port]/…, http://[::1]…). https URLs return false even though they're valid redirect targets — the point of this gate is "the callback lands on the user's own machine", which o
(raw string)
| 203 | // consent screen offer account scope to local tools (Claude Code, Cursor) while |
| 204 | // a hosted/remote client — which can't receive a localhost callback — can't. |
| 205 | func isLoopbackRedirect(raw string) bool { |
| 206 | u, err := url.Parse(raw) |
| 207 | if err != nil || u.Scheme != "http" { |
| 208 | return false |
| 209 | } |
| 210 | return isLoopbackHost(u.Hostname()) |
| 211 | } |
| 212 | |
| 213 | func validateRedirectURI(raw string) error { |
| 214 | if raw == "" { |