Getting a valid token with 200status but when trying to create a meeting im getting invalid access token

Format Your New Topic as Follows:

API Endpoint(s) and/or Zoom API Event(s)

I configured a server-to-server oauth app awith these scopes “meeting:read:admin meeting:write:admin etc” and i am trying to create a meeting.

each time i try to execute a service in my spingboot project to create a meeting through this POST endpoint”, i get this error :
401 Unauthorized: “{“code”:124,”message”:”Invalid access token.”}"
I am calling the service only once, not using multiple instances of my project or multiple thread .
When debugging, i see that i am retrieving a token, and when i try to use that token and use it in postman instead of continuing the service pocess in the debug mode, i get invalid access token too.
But if i generate the access token using Postman, the token allows me to create the meeting ( even tho im using same credentials)

So the issue is probably in this code ?

  private void generateAccessToken() {

    //the uri for generating an Access token
    URI uri = UriComponentsBuilder
        .queryParam("grant_type", "client_credentials")
        .queryParam("account_id", ACCOUNT_ID)

    //Setting basic auth credentials & Media type in header
    HttpHeaders headers = new HttpHeaders();
    headers.setBasicAuth(CLIENT_ID, CLIENT_SECRET);

    HttpEntity<?> requestEntity = new HttpEntity<>(headers);

    //Calling the endpoint
    ResponseEntity<AccessTokenResponse> responseEntity =
    if (responseEntity.getStatusCode() == HttpStatus.OK) {
      AccessTokenResponse accessTokenResponse = responseEntity.getBody();
      if (accessTokenResponse != null) {
        this.accessToken = accessTokenResponse.getAccessToken();
        this.accessTokenExpiry = LocalDateTime

  private static class AccessTokenResponse {

    private String accessToken;

    private int expiresIn;

Possibly related to this? Jwt authentication starts return 401 at 2023-06-09 13:00 UTC+9 - API and Webhooks / Authentication - Zoom Developer Forum

Thanks for reaching out to us!
It looks like you are passing the wrong grant_type in your request to generate the access_token.
If you are using a Server to Server Oauth app, you should be passing grant_type=account_credentials in your request instead of client_credentials.

could you please double check that form me ant let me know if that helped!

1 Like

Thanks for your reply, and yes you are right i have just checked that today morning!
Seems like this is your typical friday afternoon malfunction haha

Thanks again

Happy to hear its working now!
Let us know if there is anything else we could to to support you

1 Like