MCPcopy Create free account
hub / github.com/brimdata/super / PollDeviceCodeTokens

Method PollDeviceCodeTokens

api/client/auth0/auth0.go:85–105  ·  view source on GitHub ↗
(ctx context.Context, dcr DeviceCodeResponse)

Source from the content-addressed store, hash-verified

83}
84
85func (c *Client) PollDeviceCodeTokens(ctx context.Context, dcr DeviceCodeResponse) (Tokens, error) {
86 delay := time.Duration(dcr.Interval) * time.Second
87 if delay <= 0 {
88 delay = time.Second
89 }
90 for {
91 select {
92 case <-time.After(delay):
93 case <-ctx.Done():
94 return Tokens{}, ctx.Err()
95 }
96 tokens, err := c.getDeviceCodeTokens(ctx, dcr)
97 if err != nil {
98 var aerr *APIError
99 if errors.As(err, &aerr) && aerr.Kind == "authorization_pending" {
100 continue
101 }
102 }
103 return tokens, err
104 }
105}
106
107func (c *Client) getDeviceCodeTokens(ctx context.Context, dcr DeviceCodeResponse) (Tokens, error) {
108 var res tokenResponse

Callers 1

RunMethod · 0.95

Calls 5

getDeviceCodeTokensMethod · 0.95
DurationMethod · 0.80
ErrMethod · 0.80
AfterMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected