Skip to content

Commit

Permalink
Use DefaultTokenSource in adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinta Hatatani committed Feb 6, 2018
1 parent 804c297 commit 5cc3399
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ func (o sampleAdapterServerOptions) RunCustomMetricsAdapterServer(stopCh <-chan
return fmt.Errorf("unable to construct dynamic mapper: %v", err)
}

oauthClient := oauth2.NewClient(oauth2.NoContext, google.ComputeTokenSource(""))
tokenSource, err := google.DefaultTokenSource(oauth2.NoContext, "")
if err != nil {
return fmt.Errorf("unable to use default token source: %v", err)
}
oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource)
stackdriverService, err := stackdriver.New(oauthClient)
if err != nil {
return fmt.Errorf("Failed to create Stackdriver client: %v", err)
Expand Down

0 comments on commit 5cc3399

Please sign in to comment.