ZoomApi [{" code ": 200," message ":" Invalid api key or secret. "}]"

Hi, I received a token and when I send it to get the necessary data, it constantly throws the error “400: [{” code “: 200,” message “:” Invalid api key or secret. “}]”, Can you tell me how to solve this problem?

I am writing in Java, here is the code.

@SpringBootApplication
public class ZoomBotApplication {
private static final String PATH = “https://api.zoom.us/oauth/token?grant_type=client_credentials”;
private static final String clientID = “KWpd1nqwRdmQwEmBPDoubA”;
private static final String clientSecret = “RISQWhwSj03pS6d6imyk4gKl5TYXPZLH”;

public static void main(String[] args) throws Exception {
    SpringApplication.run(ZoomBotApplication.class, args);
    RestTemplate template = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    String token = clientID + ":" + clientSecret;
    String encodedString = Base64.getEncoder().encodeToString(token.getBytes());
    headers.setContentType(MediaType.APPLICATION_JSON);
    headers.add("Authorization", "Basic " + encodedString);
    HttpEntity<String> entity = new HttpEntity<>(headers);
    ResponseEntity<String> exchange = template.exchange(PATH, HttpMethod.POST, entity, String.class);
    System.out.println(exchange.getBody());


    HttpHeaders headers2 = new HttpHeaders();
    headers2.add("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiIyY2E3YjE4YS02ZWFjLTQxYzktOWRlNS05ODU0MmY1NjdmMDEifQ.eyJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiJQWjBkWllERlRQYTV4NlhNVmhkV25nIiwidmVyIjo3LCJhdWlkIjoiMTIxZTk4Y2I2MjViMWZmMTJkMjVlOGQ4MDQwOTk0MDAiLCJuYmYiOjE2MTcxMTE5ODYsImlzcyI6InptOmNpZDpLV3BkMW5xd1JkbVF3RW1CUERvdWJBIiwiZ25vIjowLCJleHAiOjE2MTcxMTU1ODYsInR5cGUiOjIsImlhdCI6MTYxNzExMTk4NiwianRpIjoiZDQ4ZDM5MDctZDg1ZC00YjQxLTlhYWUtNmE5NGY4ZWQ1MWYwIn0.Md02lkAGtDgssBYu18fWH-lCBrHF_EPDIKsG2Un-rJMjMNVK3RPphCa0XP40PGDlxtSxblRXKAqm_DVsmOPdZA");
    HttpEntity<String> entity2 = new HttpEntity<>(headers2);
    ResponseEntity<String> exchange2 = template.exchange("https://api.zoom.us/v2/users/me", HttpMethod.GET, entity2, String.class);
    System.out.println(exchange2.getBody());
}

}

Hey @cykaa1993,

Which kind of App are you generating your credentials from? Unless it’s a Chatbot, your grant_type should be authorization_code. The client_credentials grant type is unique to Chatbots only.

Please make this adjustment and let us know if you still get this error. :slight_smile:

Thanks,
Will