Hello I have a website that connects to my zoom app to revoke the token when someone disconnects their zoom account but I am getting error 400 invalid client
[Error:400,{“reason”:”Invalid client_id or client_secret”,”error”:”invalid_client”}]
I know my client id and secret are correct because I use them to connect the zoom accounts with no problem
this is my revoke function:
func revokeZoomAccount(token *oauth2.Token, dp dataprovider.Provider) (err *utils.Error) {
revokeUrl := "https://zoom.us/oauth/revoke"
// Create client with the token
client := ZoomOAuthConfig.Client(context.Background(), token)
// Prepare the form data (URL-encoded)
formData := url.Values{}
formData.Set("token", token.AccessToken) // Assuming token.AccessToken is the actual token string
// Create the request
req, rErr := http.NewRequest("POST", revokeUrl, strings.NewReader(formData.Encode()))
if rErr != nil {
return &utils.Error{Code: http.StatusInternalServerError, Message: "failed to create request"}
}
// Set the headers
clientId, _ := os.LookupEnv(env.ZoomClientId)
clientSecret, _ := os.LookupEnv(env.ZoomClientSecret)
auth := base64.StdEncoding.EncodeToString([]byte(clientId + ":" + clientSecret))
req.Header.Set("Authorization", "Basic "+auth)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, rErr := client.Do(req)
if rErr != nil {
err = &utils.Error{Code: http.StatusInternalServerError,
Message: rErr.Error(),
}
return
}
defer resp.Body.Close()
var responseBody map[string]interface{}
json.NewDecoder(resp.Body).Decode(&responseBody)
if resp.StatusCode != http.StatusOK {
err = &utils.Error{Code: http.StatusInternalServerError, Message: "failed to revoke token"}
}
return
}
does anyone know what is going on?