# Need help on how to programatically get Access Token \[PHP\]

**URL:** <https://devforum.zoom.us/t/need-help-on-how-to-programatically-get-access-token-php/46516>\
**Category:** API and Webhooks\
**Created:** [March 24, 2021, 9:11pm UTC](https://devforum.zoom.us/t/need-help-on-how-to-programatically-get-access-token-php/46516 "2021-03-24T21:11:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasprem95](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/thomasprem95/32/22514_2.png) [@thomasprem95](https://devforum.zoom.us/u/thomasprem95)\
**Post date:** [March 24, 2021, 9:11pm UTC](https://devforum.zoom.us/t/need-help-on-how-to-programatically-get-access-token-php/46516/1 "2021-03-24T21:11:05Z")

</div>

I need some help to how we can get Access Token for Zoom API? I need how can I implement it in a function so that I can refresh the zoom token every one hour

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [March 25, 2021, 3:08pm UTC](https://devforum.zoom.us/t/need-help-on-how-to-programatically-get-access-token-php/46516/2 "2021-03-25T15:08:18Z")

</div>

Hi @thomasprem95,

Happy to help point you in the right direction. Have you had a chance to review our OAuth flow here yet?

> **[OAuth 2.0 - Authorization - Documentation](https://marketplace.zoom.us/docs/guides/auth/oauth)**
>
> OAuth with Zoom
> 
> The Zoom API uses OAuth 2.0 to authenticate and authorize users to make requests. To setup access credentials and request scopes for yo...

You can programmatically request the access\_token from our OAuth endpoint. The API response will return both an access\_token and a refresh\_token—after you use the initial access\_token, you’ll use that refresh\_token that was returned initially to then request a new access\_token on a regular cadence.

After you retrieve the authorization\_code by installing your OAuth App, you can programmatically get the acsess\_token and refresh\_token—here is an example request in PHP:

```auto
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://zoom.us/oauth/token?grant_type=authorization_code&code=%7Bcode%7D&redirect_uri=%7BredirectUrl%7D",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Basic {token}"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

Best,  
Will

---

<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 25, 2021, 1:09am UTC](https://devforum.zoom.us/t/need-help-on-how-to-programatically-get-access-token-php/46516/3 "2021-04-25T01:09:16Z")

</div>

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