Skip to content

Commit bc6a2d2

Browse files
committed
fix error handling
1 parent 547b7ab commit bc6a2d2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

deviceauth.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212

1313
"golang.org/x/net/context/ctxhttp"
14+
"golang.org/x/oauth2/internal"
1415
)
1516

1617
const (
@@ -77,5 +78,9 @@ func parseError(err error) string {
7778
_ = json.Unmarshal(e.Body, &eResp)
7879
return eResp["error"]
7980
}
81+
e2, ok := err.(*internal.TokenError)
82+
if ok {
83+
return e2.Err
84+
}
8085
return ""
8186
}

oauth2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (c *Config) Poll(ctx context.Context, da *DeviceAuth, opts ...AuthCodeOptio
275275
case errAccessDenied, errExpiredToken:
276276
return tok, errors.New("oauth2: " + errTyp)
277277
case errSlowDown:
278-
interval += 1
278+
interval += 5
279279
fallthrough
280280
case errAuthorizationPending:
281281
}

0 commit comments

Comments
 (0)