authorization enforced on webpages

This commit is contained in:
2025-12-30 18:08:22 -07:00
parent c01d700482
commit 240d82344c
24 changed files with 509 additions and 123 deletions
-6
View File
@@ -100,22 +100,16 @@ func (a *Authenticator) Exchange(ctx context.Context, state, code string) (acces
return "", time.Time{}, fmt.Errorf("failed to exchange an authorization code for a token: %w", err)
}
fmt.Println("TOKEN:", token)
idToken, err := a.VerifyIDToken(ctx, token)
if err != nil {
return "", time.Time{}, fmt.Errorf("failed to verify ID Token: %w", err)
}
fmt.Println("ID TOKEN:", idToken)
var claims map[string]any
if err := idToken.Claims(&claims); err != nil {
return "", time.Time{}, fmt.Errorf("Failed to obtain id token claims: %w", err)
}
fmt.Println("CUSTOM CLAIMS / PROFILE:", claims)
claimsJSON, _ := json.Marshal(claims)
// store the token, and the potentially new user