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

Clarify context should be replaced based on application usage #307

Merged
merged 1 commit into from
Nov 6, 2023
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
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