-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
The Login API is supposed to sign-in a User and return a "Set-Cookie" header that contains the refresh token and access token, but the client does not read the headers from the response, nor does it return them.
A workaround is to call the login API yourself instead of using the go-client and reading the headers from the response.
func (rc *restClient) Do() error {
req, err := http.NewRequest("POST", rc.Uri.String(), rc.Body)
if err != nil {
return err
}
for key, val := range rc.Headers {
req.Header.Set(key, val)
}
resp, err := rc.HTTPClient.Do(req)
if err != nil {
return err
}
// Reading the headers from the response
key := resp.Header.Values("Set-Cookie")
if key != nil {
rc.Cookie = key
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode > 299 {
return errors.BaseBadRequest
} else {
rc.ErrorRef = nil
if _, ok := rc.ResponseRef.(*BaseHTTPResponse); !ok {
err = json.NewDecoder(resp.Body).Decode(rc.ResponseRef)
}
}
return err
}
This is a workaround that I have used.
crobby
Metadata
Metadata
Assignees
Labels
No labels