Skip to content

Commit

Permalink
Reset context when getting token
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught committed Jun 25, 2023
1 parent 975bc96 commit 565a0c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func ConfigureProvider(terraformVersion *string) schema.ConfigureContextFunc {
debug := data.Get("debug").(bool)

apiClient, err := management.New(domain,
authenticationOption(ctx, clientID, clientSecret, apiToken, audience),
authenticationOption(clientID, clientSecret, apiToken, audience),
management.WithDebug(debug),
management.WithUserAgent(userAgent(terraformVersion)),
management.WithAuth0ClientEnvEntry(providerName, version),
Expand Down Expand Up @@ -88,7 +88,9 @@ func userAgent(terraformVersion *string) string {
}

// authenticationOption computes the desired authentication option for the *management.Management client.
func authenticationOption(ctx context.Context, clientID, clientSecret, apiToken, audience string) management.Option {
func authenticationOption(clientID, clientSecret, apiToken, audience string) management.Option {
ctx := context.Background()

if apiToken != "" {
return management.WithStaticToken(apiToken)
}
Expand Down

0 comments on commit 565a0c4

Please sign in to comment.