# Error scheduling meeting: {"code":124,"message":"Invalid access token."}

**URL:** <https://devforum.zoom.us/t/error-scheduling-meeting-code-124-message-invalid-access-token/124824>\
**Category:** Meetings\
**Tags:** api, video-sdk\
**Created:** [January 17, 2025, 7:09pm UTC](https://devforum.zoom.us/t/error-scheduling-meeting-code-124-message-invalid-access-token/124824 "2025-01-17T19:09:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![puneetmalhotra21](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/puneetmalhotra21/32/66482_2.png) [@puneetmalhotra21](https://devforum.zoom.us/u/puneetmalhotra21)\
**Post date:** [January 17, 2025, 7:09pm UTC](https://devforum.zoom.us/t/error-scheduling-meeting-code-124-message-invalid-access-token/124824/1 "2025-01-17T19:09:46Z")

</div>

Error scheduling meeting: {“code”:124,“message”:“Invalid access token.”}  
not sure what i am missing.

I am adding required scope from Scope List.  
Getting Auth Token successfully.But when creaeting meetinh link, getting above error  
I have tried everything but not solution.

String accessToken = ZoomMeetingScheduler.getAccessToken();  
String apiUrl = /users/me/meetings  
String startTime = appointment.Requested\_DateTime\_\_c.addHours(1).format(‘yyyy-MM-dd'T'HH:mm:ss'Z'’);  
system.debug(‘accessToken :::’+accessToken );  
HttpRequest req = new HttpRequest();  
req.setEndpoint(apiUrl);  
req.setMethod(‘POST’);  
req.setHeader(‘Authorization’, 'Bearer ’ + accessToken);  
req.setHeader(‘Content-Type’, ‘application/json’);

```
Map<String, Object> meetingDetails = new Map<String, Object>{
    'topic' => appointment.Subject__c,
    'type' => 2,
    'start_time' => startTime,
    'duration' => 60,
    'timezone' => 'UTC',
    'agenda' => appointment.Meeting_Notes__c,
    'settings' => new Map<String, Object>{
        'host_video' => true,
        'participant_video' => true
    }
};

req.setBody(JSON.serialize(meetingDetails));

Http http = new Http();
HttpResponse res = http.send(req);

```

---

<div class="post-metadata">

**Author:** ![MultiplayerSession](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/multiplayersession/32/66446_2.png) [@MultiplayerSession](https://devforum.zoom.us/u/MultiplayerSession)\
**Post date:** [January 17, 2025, 8:55pm UTC](https://devforum.zoom.us/t/error-scheduling-meeting-code-124-message-invalid-access-token/124824/2 "2025-01-17T20:55:42Z")

</div>

How recently did you request that access token? The token lifetime should be disclosed when you receive it, and it might expire after 1 hour. Basically, I’m wondering what `ZoomMeetingScheduler.getAccessToken()` does in your code snippet — perhaps it’s using a previously-retrieved token without checking for its expiration.

---

<div class="post-metadata">

**Author:** ![puneetmalhotra21](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/puneetmalhotra21/32/66482_2.png) [@puneetmalhotra21](https://devforum.zoom.us/u/puneetmalhotra21)\
**Post date:** [January 18, 2025, 7:36am UTC](https://devforum.zoom.us/t/error-scheduling-meeting-code-124-message-invalid-access-token/124824/3 "2025-01-18T07:36:54Z")

</div>

Thanks for replying Christopher  
In the same transaction i m retrieving and using the token.

Zoom access tokens generated through OAuth 2.0 expire **1 hour (3600 seconds)** after they are issued but i am using immediately.

Also i have given all possible Scope. But no solution

Here is snippet written in Salesforce

public static String getAccessToken() {  
String clientId = ‘CLIENT\_ID’;  
String clientSecret = ‘CLIENT\_SECRET’;  
String credentials = clientId + ‘:’ + clientSecret;  
String encodedCredentials = EncodingUtil.base64Encode(Blob.valueOf(credentials));

```
    HttpRequest req = new HttpRequest();
    req.setEndpoint('https://zoom.us/oauth/token');
    req.setMethod('POST');
    req.setHeader('Authorization', 'Basic ' + encodedCredentials);
    req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
    req.setBody('grant_type=client_credentials');

    Http http = new Http();
    HttpResponse res = http.send(req);

    if (res.getStatusCode() == 200) {
        Map<String, Object> responseBody = (Map<String, Object>) JSON.deserializeUntyped(res.getBody());
        return (String) responseBody.get('access_token');
    } else {
        System.debug('Failed to get access token: ' + res.getBody());
        throw new CalloutException('Error: Unable to fetch access token.');
    }
}

```

---

<div class="post-metadata">

**Author:** ![alexm](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexm/32/67701_2.png) [@alexm](https://devforum.zoom.us/u/alexm)\
**Post date:** [March 9, 2025, 4:34am UTC](https://devforum.zoom.us/t/error-scheduling-meeting-code-124-message-invalid-access-token/124824/4 "2025-03-09T04:34:42Z")

</div>

> [@puneetmalhotra21](#):
>
> `req.setBody('grant_type=client_credentials')`

You might try appending `&account_id=<your account id>` to the above line. Additionally, if that doesn’t solve it, keep the account id addition but change the grant type to “account\_credentials”
