You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
The client libraries cover ~95% of the functionality of the REST API, but not 100%. Cookies, JWT authentication, and http status codes are some of the holes.
I'm leaving this open for possible future work (which would take place in https://github.com/fusionauth/fusionauth-client-builder so that every client library could benefit), but since there's a straightforward workaround, can't commit to a timeline.
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.
This is a workaround that I have used.
The text was updated successfully, but these errors were encountered: