fix console auth headers for go java client
This commit is contained in:
parent
a9ab2b8589
commit
b2f814f984
@ -326,8 +326,7 @@ func (c *Client) AuthenticateConsoleToken(ctx context.Context, authorization str
|
|||||||
}
|
}
|
||||||
|
|
||||||
endpoint := strings.TrimRight(c.cfg.Java.ConsoleBaseURL, "/") + "/account/info"
|
endpoint := strings.TrimRight(c.cfg.Java.ConsoleBaseURL, "/") + "/account/info"
|
||||||
headers := http.Header{}
|
headers := javaConsoleHeaders(authorization)
|
||||||
headers.Set("Authorization", authorization)
|
|
||||||
|
|
||||||
var resp resultResponse[ConsoleAccount]
|
var resp resultResponse[ConsoleAccount]
|
||||||
if err := c.getJSON(ctx, endpoint, headers, &resp); err != nil {
|
if err := c.getJSON(ctx, endpoint, headers, &resp); err != nil {
|
||||||
@ -339,6 +338,18 @@ func (c *Client) AuthenticateConsoleToken(ctx context.Context, authorization str
|
|||||||
return resp.Body, nil
|
return resp.Body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func javaConsoleHeaders(authorization string) http.Header {
|
||||||
|
headers := http.Header{}
|
||||||
|
headers.Set("Authorization", strings.TrimSpace(authorization))
|
||||||
|
headers.Set("Req-Sys-Origin", "origin=ops;originChild=ops;")
|
||||||
|
headers.Set("Req-Client", "Ops")
|
||||||
|
headers.Set("Req-App-Intel", "version=1.0.0;build=1;channel=ops;")
|
||||||
|
headers.Set("Req-Version", "v2")
|
||||||
|
headers.Set("Req-Lang", "zh-CN")
|
||||||
|
headers.Set("Req-Zone", "Asia/Shanghai")
|
||||||
|
return headers
|
||||||
|
}
|
||||||
|
|
||||||
func parseUserCredentialToken(token string) (UserCredential, error) {
|
func parseUserCredentialToken(token string) (UserCredential, error) {
|
||||||
token = strings.TrimSpace(token)
|
token = strings.TrimSpace(token)
|
||||||
if token == "" {
|
if token == "" {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user