Skip to content

Commit

Permalink
Parse Mist auth response correctly (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomshutt committed Aug 15, 2022
1 parent edc5202 commit aec5ca9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions handlers/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,15 @@ func validateAuth(resp string, err error) error {
return err
}
r := struct {
Authorize map[string]string `json:"authorize"`
Authorize struct {
Status string `json:"status"`
} `json:"authorize"`
}{}

if err := json.Unmarshal([]byte(resp), &r); err != nil {
return err
}
if r.Authorize["status"] != "OK" {
if r.Authorize.Status != "OK" {
return errors.New("authorization to Mist API failed")
}
return nil
Expand Down

0 comments on commit aec5ca9

Please sign in to comment.