Skip to content

Commit fa3a703

Browse files
Correct code example in auth/doc.go (#163)
1 parent c1bb6dc commit fa3a703

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

auth/doc.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ Usage
2222
Construct a new client Config, then use the various methods to complete a flow.
2323
For example:
2424
25-
config := auth.NewConfigWithOptions(nil, auth.SetClientID("my-client-id"), auth.SetScopes([]string{"openid"}))
26-
27-
code, _, err := config.RequestCode(ctx)
28-
if err!= nil {
25+
config, err := auth.NewConfigWithOptions(nil, auth.SetClientID("my-client-id"), auth.SetScopes([]string{"openid"}))
26+
if err != nil {
27+
panic(err)
28+
}
29+
code, _, err := config.RequestCode(context.TODO())
30+
if err != nil {
2931
panic(err)
3032
}
31-
token, _, err := config.PollToken(ctx, code)
32-
if err!= nil {
33+
token, _, err := config.PollToken(context.TODO(), code)
34+
if err != nil {
3335
panic(err)
3436
}
35-
fmt.PrintLn(accessToken.AccessToken)
37+
fmt.Println(token.AccessToken)
3638
3739
NOTE: Using the https://godoc.org/context package, one can easily
3840
pass cancellation signals and deadlines to various services of the client for

0 commit comments

Comments
 (0)