type Token struct {
Status string `json:"status"`
Metadata struct {
Trace_id string `json:"trace_id"`
} `json:"metadata"`
Data struct {
Access_token string `json:"access_token"`
Expires_in int `json:"expires_in"`
} `json:"data"`
}
func (s *Server) getTokenFromHttp() (string, error) {
data := url.Values{}
data.Set("username", "aaa")
data.Add("password", "xxxxx")
url := "https://xxx.com/v1/user/token"
req, err := http.NewRequest("POST", url, bytes.NewBufferString(data.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := &http.Client{}