Skip to content

Commit

Permalink
chore: Improve README example
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspersorensen committed Feb 29, 2024
1 parent fd63007 commit d565b27
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,10 @@ import (
// create API client
api := digiseg.NewAPIClient(digiseg.NewConfiguration())

// authenticate with username+password
req := api.AuthAPI.CreateAccessToken(context.Background()).AuthTokenRequest(digiseg.AuthTokenRequest{
Username: username,
Password: &password,
})
authResp, _, err := req.Execute()
if err != nil {
return "", err
}

// look up audiences
ctx := context.WithValue(context.Background(), digiseg.ContextAccessToken, *authResp.AccessToken)
ctx := context.WithValue(context.Background(), digiseg.ContextAPIKeys, map[string]digiseg.APIKey{
"apiKeyHeaderAuth": {Key: apiKey},
})
req = api.AudiencesAPI.ResolveAudiencesOfSingle(ctx, ipAddress)
audiencesResponse, _, err := req.Execute()
```
Expand Down

0 comments on commit d565b27

Please sign in to comment.