Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ func (c *Client) VerifyIDToken(ctx context.Context, idToken string) (*Token, err
return nil, fmt.Errorf("id token must be a non-empty string")
}

if err := verifyToken(ctx, idToken, c.keySource); err != nil {
return nil, err
}
segments := strings.Split(idToken, ".")

var (
Expand Down Expand Up @@ -281,6 +278,13 @@ func (c *Client) VerifyIDToken(ctx context.Context, idToken string) (*Token, err
return nil, err
}
payload.UID = payload.Subject

// Verifying the signature requires syncronized access to a key store and
// potentially issues a http request. Validating the fields of the token is
// cheaper and invalid tokens will fail faster.
if err := verifyToken(ctx, idToken, c.keySource); err != nil {
return nil, err
}
return &payload, nil
}

Expand Down