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 #666 Change-Id: I89e354368bbb0a4e3b979bb547b4cb37bbe1cc02 GitHub-Last-Rev: bbf169b52d7e5c375da31c664adafc2423d22a8f GitHub-Pull-Request: golang/oauth2#667 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/527835 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Nikolay Turpitko <nick.turpitko@gmail.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Matt Hickford <matt.hickford@gmail.com>
diff --git a/deviceauth.go b/deviceauth.go index 85ef796..e99c92f 100644 --- a/deviceauth.go +++ b/deviceauth.go
@@ -59,6 +59,8 @@ type Alias DeviceAuthResponse aux := &struct { ExpiresIn int64 `json:"expires_in"` + // workaround misspelling of verification_uri + VerificationURL string `json:"verification_url"` *Alias }{ Alias: (*Alias)(c), @@ -69,6 +71,9 @@ if aux.ExpiresIn != 0 { c.Expiry = time.Now().UTC().Add(time.Second * time.Duration(aux.ExpiresIn)) } + if c.VerificationURI == "" { + c.VerificationURI = aux.VerificationURL + } return nil }