# Help me to migrate from JWT to OAuth using PHP Curl

**URL:** <https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811>\
**Category:** API and Webhooks\
**Tags:** api, php\
**Created:** [March 16, 2023, 12:52pm UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811 "2023-03-16T12:52:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dora\_Reddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dora_reddy/32/21698_2.png) [@Dora\_Reddy](https://devforum.zoom.us/u/Dora_Reddy)\
**Post date:** [March 16, 2023, 12:52pm UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/1 "2023-03-16T12:52:38Z")

</div>

Hello All,

We have integrated zoom api with jwt authentication.

As JWT is deprecating soon, need to migrate it Server-to-Server OAuth or an OAuth app.

From the above 2 (Server-to-Server OAuth or an OAuth app) which one is easy and safe in coding point of view.

Someone please share code or guide for migrating

Thanks

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [March 17, 2023, 2:03am UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/2 "2023-03-17T02:03:31Z")

</div>

Hi @Dora_Reddy ,

Server-to-Server OAuth app is the most closely related to JWT in terms of access and purpose.

- [When to use Server-to-Server OAuth app and when to use OAuth app ? - DEV Community](https://dev.to/zoom/when-to-use-server-to-server-oauth-app-and-when-to-use-oauth-app--579n)
- [JWT app vs Server to Server OAuth app - DEV Community](https://dev.to/zoom/jwt-app-vs-server-to-server-oauth-app-p08)

To get started, take a look at our Postman Workspace for guidance on Server-to-Server OAuth: [Create meeting link on behalf of external users by hosting OAuth Account Level APP - #3 by hmshah.1984](https://devforum.zoom.us/t/create-meeting-link-on-behalf-of-external-users-by-hosting-oauth-account-level-app/77266/3)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/b/6bb27a6e19b00eed401c45003a170c2dbc14a2c4.png)

You can use Postman’s code snippet feature for sample code:

 ![Screenshot 2023-03-16 at 7.02.02 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/2/f/2f4c0e1da59bbfee426f2c68d6bd90bd63855451.png)

---

<div class="post-metadata">

**Author:** ![Dora\_Reddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dora_reddy/32/21698_2.png) [@Dora\_Reddy](https://devforum.zoom.us/u/Dora_Reddy)\
**Post date:** [March 20, 2023, 3:12pm UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/4 "2023-03-20T15:12:12Z")

</div>

Hello @gianni.zoom Thanks for the details.

When using jwt authentication, Only JWT token enough for all API calls.

So how can i need to change my existing code below with OAuth Please help

```
            $request_url = 'https://api.zoom.us/v2/users/'.$host_id.'/meetings';
        $headers = array( "authorization: Bearer ".$this->zoom_jwt_token,
                           "content-type: application/json"
                        ); 
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $request_url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
	curl_setopt($ch, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$customrequest);
	if(isset($data) && !empty($data))
	{
	$postFields = json_encode($data);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
	}
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
	$response = curl_exec($ch);

```

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [March 21, 2023, 6:07am UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/5 "2023-03-21T06:07:29Z")

</div>

> [@Dora\_Reddy](#):
>
> When using jwt authentication, Only JWT token enough for all API calls.

Do you mean only JWT allows you to access all API endpoints? Or that JWT does not expire?

For Server-to-Server OAuth, you can access all the endpoints with the correct [scopes](https://marketplace.zoom.us/docs/guides/auth/oauth/oauth-scopes/). As far as token expiry, Server-to-Server OAuth expires after 1 hour and you need to generate a new token unlike with JWT where you can set the expiration for as long as you want.

---

<div class="post-metadata">

**Author:** ![Dora\_Reddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dora_reddy/32/21698_2.png) [@Dora\_Reddy](https://devforum.zoom.us/u/Dora_Reddy)\
**Post date:** [March 21, 2023, 3:14pm UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/6 "2023-03-21T15:14:06Z")

</div>

@gianni.zoom  
We actually set JWT for longer expiration date and save it in DB and used the JWT token for all API calls.

So for Server-to-Server OAuth, Is it ok to set high-level scope for App and use it for all API end points?

Can you please provide me php code for **create meeting API with Server-to-Server OAuth**.

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [March 21, 2023, 4:35pm UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/7 "2023-03-21T16:35:42Z")

</div>

> [@Dora\_Reddy](#):
>
> So for Server-to-Server OAuth, Is it ok to set high-level scope for App and use it for all API end points?

Yes this is okay.

> [@Dora\_Reddy](#):
>
> Can you please provide me php code for **create meeting API with Server-to-Server OAuth**.

Click on the code icon and scroll for PHP snippet: [Postman](https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/request/22097587-21d690f8-85f6-42db-8237-6de89c63289f?ctx=code)

---

<div class="post-metadata">

**Author:** ![Dora\_Reddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dora_reddy/32/21698_2.png) [@Dora\_Reddy](https://devforum.zoom.us/u/Dora_Reddy)\
**Post date:** [April 13, 2023, 1:39pm UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/8 "2023-04-13T13:39:35Z")

</div>

Thanks for the help. I’m successfully migrated from JWT to Server-to-Server OAuth.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 16, 2024, 5:16am UTC](https://devforum.zoom.us/t/help-me-to-migrate-from-jwt-to-oauth-using-php-curl/84811/9 "2024-04-16T05:16:15Z")

</div>

Closed on April 16, 2024, 5:16am UTC

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.
