MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / Authenticate

Method Authenticate

lib/auth/gcip_authenticator.go:68–86  ·  view source on GitHub ↗

Authenticate authenticates a user using the provided ID token.

(ctx context.Context, idToken string)

Source from the content-addressed store, hash-verified

66
67// Authenticate authenticates a user using the provided ID token.
68func (a GCIPAuthenticator) Authenticate(ctx context.Context, idToken string) (*User, error) {
69 // Verify the ID token using the Firebase Auth client.
70 token, err := a.VerifyIDToken(ctx, idToken)
71 if err != nil {
72 return nil, err
73 }
74
75 gitHubUserID, found := extractGitHubUserIDFromToken(token)
76 if !found {
77 slog.WarnContext(ctx, "github user ID not found in token", "identities", token.Firebase.Identities,
78 "uid", token.UID)
79 }
80
81 // Create a new user object using the user's ID from the token.
82 return &User{
83 ID: token.UID,
84 GitHubUserID: gitHubUserID,
85 }, nil
86}

Callers 1

TestGCIPAuthenticatorFunction · 0.95

Calls 2

VerifyIDTokenMethod · 0.65

Tested by 1

TestGCIPAuthenticatorFunction · 0.76