Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

tests: oauth fake attributes Google userinfo by its access_token query parameter

Claude20210d7e50e8
diff --git a/tests/fakes/oauth/oauth.go b/tests/fakes/oauth/oauth.go
index 268284c893..3beccc6096 100644
--- a/tests/fakes/oauth/oauth.go
+++ b/tests/fakes/oauth/oauth.go
@@ -70,6 +70,11 @@ func (s service) Scope(r *http.Request) (string, bool) {
code := r.PostForm.Get("code")
return code, code != ""
}
+ // Google's userinfo call carries the token as a query parameter rather than a
+ // header.
+ if token := r.URL.Query().Get("access_token"); token != "" {
+ return token, true
+ }
token, ok := strings.CutPrefix(r.Header.Get("Authorization"), "Bearer ")
return token, ok && token != ""
}