Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(idtoken): provide default scope for cert endpoint #1198

Merged
merged 1 commit into from Aug 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions idtoken/validate.go
Expand Up @@ -19,6 +19,7 @@ import (
"strings"
"time"

"google.golang.org/api/option/internaloption"
htransport "google.golang.org/api/transport/http"
)

Expand All @@ -34,6 +35,10 @@ var (
now = time.Now
)

func defaultValidatorOpts() []ClientOption {
return []ClientOption{internaloption.WithDefaultScopes("https://www.googleapis.com/auth/cloud-platform")}
}

// Payload represents a decoded payload of an ID Token.
type Payload struct {
Issuer string `json:"iss"`
Expand Down Expand Up @@ -88,6 +93,7 @@ type Validator struct {
// NewValidator creates a Validator that uses the options provided to configure
// a the internal http.Client that will be used to make requests to fetch JWKs.
func NewValidator(ctx context.Context, opts ...ClientOption) (*Validator, error) {
opts = append(defaultValidatorOpts(), opts...)
client, _, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
Expand Down