I’ve the following code which I want to get the token from the request , I pass the API/ClientSecret/ClientID
r := fmt.Sprintf("https://tenenat.host.com/oauth/token?grant_type=client_credentials&response_type=token&client_id=%s&client_secret=%s", CI, CS)
req, err := http.NewRequest(http.MethodPost, r, nil)
req.Header.Set("accept", "application/json")
res, err := httpClient.Do(req)
if err != nil {
fmt.Println(os.Stdout)
var t OAuthAccessResponse
if err := json.NewDecoder(res.Body).Decode(&t); err != nil {
fmt.Println(os.Stdout, "could not parse JSON response: %v", err)
}
defer res.Body.Close()
}
When running it I got error :
http 400 bad request .
Any idea if I miss something in the request ?
Im not able to format the code right :)