Skip to content

Commit

Permalink
Clarify context should be replaced based on application usage (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored Nov 6, 2023
1 parent e8d2f5e commit ba83c16
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func main() {

// Initialize a new client using a domain, client ID and client secret.
authAPI, err := authentication.New(
context.Background(),
context.TODO(), // Replace with a Context that better suits your usage
domain,
authentication.WithClientID(clientID),
authentication.WithClientSecret(clientSecret), // Optional depending on the grants used
Expand Down Expand Up @@ -131,7 +131,7 @@ func main() {
// `management.WithStaticToken("token")`
auth0API, err := management.New(
domain,
management.WithClientCredentials(context.Background(), clientID, clientSecret),
management.WithClientCredentials(context.TODO(), clientID, clientSecret), // Replace with a Context that better suits your usage
)
if err != nil {
log.Fatalf("failed to initialize the auth0 management API client: %+v", err)
Expand All @@ -147,7 +147,7 @@ func main() {
// The passed in client will get hydrated with the response.
// This means that after this request, we will have access
// to the client ID on the same client object.
err = auth0API.Client.Create(context.Background(), client)
err = auth0API.Client.Create(context.TODO(), client) // Replace with a Context that better suits your usage
if err != nil {
log.Fatalf("failed to create a new client: %+v", err)
}
Expand All @@ -160,7 +160,6 @@ func main() {
)
}
```

> **Note**
> The [context](https://pkg.go.dev/context?utm_source=godoc) package can be used to pass cancellation signals and deadlines to the Client for handling a request. If there is no context available then `context.Background()` can be used.
Expand Down

0 comments on commit ba83c16

Please sign in to comment.