Skip to content

Commit 14b275c

Browse files
hickfordgopherbot
authored andcommitted
oauth2: workaround misspelling of verification_uri
Some servers misspell verification_uri as verification_url, contrary to spec RFC 8628 Example server https://issuetracker.google.com/issues/151238144 Fixes golang#666 Change-Id: I89e354368bbb0a4e3b979bb547b4cb37bbe1cc02 GitHub-Last-Rev: bbf169b GitHub-Pull-Request: golang#667 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/527835 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Nikolay Turpitko <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Matt Hickford <[email protected]>
1 parent 18352fc commit 14b275c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

deviceauth.go

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
5959
type Alias DeviceAuthResponse
6060
aux := &struct {
6161
ExpiresIn int64 `json:"expires_in"`
62+
// workaround misspelling of verification_uri
63+
VerificationURL string `json:"verification_url"`
6264
*Alias
6365
}{
6466
Alias: (*Alias)(c),
@@ -69,6 +71,9 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
6971
if aux.ExpiresIn != 0 {
7072
c.Expiry = time.Now().UTC().Add(time.Second * time.Duration(aux.ExpiresIn))
7173
}
74+
if c.VerificationURI == "" {
75+
c.VerificationURI = aux.VerificationURL
76+
}
7277
return nil
7378
}
7479

0 commit comments

Comments
 (0)