workaround verification_url

This commit is contained in:
M Hickford
2023-09-12 20:53:07 +01:00
parent 2d9e4a2adf
commit bbf169b52d

View File

@@ -58,6 +58,8 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
type Alias DeviceAuthResponse type Alias DeviceAuthResponse
aux := &struct { aux := &struct {
ExpiresIn int64 `json:"expires_in"` ExpiresIn int64 `json:"expires_in"`
// workaround misspelling of verification_uri
VerificationURL string `json:"verification_url"`
*Alias *Alias
}{ }{
Alias: (*Alias)(c), Alias: (*Alias)(c),
@@ -68,6 +70,9 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
if aux.ExpiresIn != 0 { if aux.ExpiresIn != 0 {
c.Expiry = time.Now().UTC().Add(time.Second * time.Duration(aux.ExpiresIn)) c.Expiry = time.Now().UTC().Add(time.Second * time.Duration(aux.ExpiresIn))
} }
if c.VerificationURI == "" {
c.VerificationURI = aux.VerificationURL
}
return nil return nil
} }