Fix authorization with firmware v3.0.*

After upgrade to firmware version 3.0.41-IMS-KDG
vodafone-station-exporter stopped working
crashing with a segmentation violation after querying
/api/v1/phone_calllog/1,2/CallTbl.

Checking the HTTP traffic all API requests requiring authentication
failed with HTTP error 401 and JSON response
{"error":"error","message":"Unauthorized user!"}

Adding a simple GET request to /api/v1/session/menu directly after the
final login POST request fixes this.
This commit is contained in:
Gerrit M. Keller 2021-12-05 10:40:29 +00:00 committed by Ruben Jenster
parent ce763bb1a9
commit cd742fe7b6

View file

@ -257,6 +257,10 @@ func (v *VodafoneStation) Login() (*LoginResponse, error) {
if loginResponse.Error != "ok" {
return nil, fmt.Errorf("Got non error=ok message from vodafone station")
}
_, err = v.doRequest("GET", v.URL+"/api/v1/session/menu", "")
if err != nil {
return nil, err
}
return loginResponse, nil
}