Skip to content

Commit

Permalink
workaround verification_url
Browse files Browse the repository at this point in the history
  • Loading branch information
hickford committed Sep 12, 2023
1 parent 2d9e4a2 commit bbf169b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions deviceauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
type Alias DeviceAuthResponse
aux := &struct {
ExpiresIn int64 `json:"expires_in"`
// workaround misspelling of verification_uri
VerificationURL string `json:"verification_url"`
*Alias
}{
Alias: (*Alias)(c),
Expand All @@ -68,6 +70,9 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
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
}

Expand Down

0 comments on commit bbf169b

Please sign in to comment.