Fix user impersonation requests
This commit is contained in:
parent
0b898af164
commit
28b6efc18c
@ -80,9 +80,12 @@ func (req *Request) Do() error {
|
|||||||
if req.CW.AuthAPIKey != "" {
|
if req.CW.AuthAPIKey != "" {
|
||||||
httpreq.Header.Set("Authorization", req.CW.AuthAPIKey)
|
httpreq.Header.Set("Authorization", req.CW.AuthAPIKey)
|
||||||
} else { //User impersonation
|
} else { //User impersonation
|
||||||
httpreq.Header.Set("Cookie", fmt.Sprintf("companyName=%s", req.CW.CompanyName))
|
cookieCompanyName := http.Cookie{Name: "companyName", Value: req.CW.CompanyName}
|
||||||
httpreq.Header.Set("Cookie", fmt.Sprintf("memberHash=%s", req.CW.AuthMemberHash))
|
cookieMemberHash := http.Cookie{Name: "memberHash", Value: req.CW.AuthMemberHash}
|
||||||
httpreq.Header.Set("Cookie", fmt.Sprintf("MemberID=%s", req.CW.AuthUsername))
|
cookieMemberID := http.Cookie{Name: "memberID", Value: req.CW.AuthUsername}
|
||||||
|
httpreq.AddCookie(&cookieCompanyName)
|
||||||
|
httpreq.AddCookie(&cookieMemberHash)
|
||||||
|
httpreq.AddCookie(&cookieMemberID)
|
||||||
}
|
}
|
||||||
httpreq.Header.Set("Content-Type", "application/json")
|
httpreq.Header.Set("Content-Type", "application/json")
|
||||||
resp, err := client.Do(httpreq)
|
resp, err := client.Do(httpreq)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user