authorization enforced on webpages
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user