# Invalid\_grant issue while try to get refresh token

**URL:** <https://devforum.zoom.us/t/invalid-grant-issue-while-try-to-get-refresh-token/75132>\
**Category:** Meetings\
**Created:** [August 30, 2022, 2:09pm UTC](https://devforum.zoom.us/t/invalid-grant-issue-while-try-to-get-refresh-token/75132 "2022-08-30T14:09:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![job1608](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/job1608/32/40539_2.png) [@job1608](https://devforum.zoom.us/u/job1608)\
**Post date:** [August 30, 2022, 2:09pm UTC](https://devforum.zoom.us/t/invalid-grant-issue-while-try-to-get-refresh-token/75132/1 "2022-08-30T14:09:56Z")

</div>

Hi , I am using Oauth 2.0 authentication for create meeting. so when i generate access token first time it works . but when i am try to get refresh token then getting error

> “reason” =\> “Invalid Token!”  
> “error” =\> “invalid\_grant”

I am passing API like this way.

> **URL :-** [https://zoom.us/oauth/token](https://zoom.us/oauth/token)  
> **Request Parameter :-**  
> grant\_type=refresh\_token&refresh\_token=eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiI5MGUwZTYyMS05YzRjLTRmZTEtYWY0Ny01Njk5NWE5MmVmZWUifQ.eyJ2ZXIiOjcsImF1aWQiOiIzZTliMTY2ZmUxMDIyODUyYTBiMTJjZjI0MGJlYmQ2OSIsImNvZGUiOiI5S2s2NEFZNHdtXzFrTmw5WGVwVFYyZXVpUDg4S1JhQ3ciLCJpc3MiOiJ6bTpjaWQ6R0hiX1FXd2FRaWU2M1J1dloxWFBRIiwiZ25vIjowLCJ0eXBlIjoxLCJ0aWQiOjEsImF1ZCI6Imh0dHBzOi8vb2F1dGguem9vbS51cyIsInVpZCI6IjFrTmw5WGVwVFYyZXVpUDg4S1JhQ3ciLCJuYmYiOjE2NjE4NjE3OTIsImV4cCI6MjEzNDkwMTc5MiwiaWF0IjoxNjYxODYxNzkyLCJhaWQiOiJNSDNSQUQzRlFIaS13RWxTN2k4ZjR3IiwianRpIjoiMjhmMDI2ZDEtOTY1Yi00MjNkLWEyNWEtYzFhOWM5ZGMyZWNhIn0.uJKQjoWMYqn8AtBoWH3Fkwy1weLB8RI6Zly6B6JJ6pZifWZHsIh18Hs8buh3LIPFkhnI-WhpLqSm2jlG6YBy8A
> 
> **Authorization Header :-**  
> Authorization:Basic R0hiX1FXd2FRaWU2M1J1dloxWFBROjdVNWdDclU2M25qY2dJNnQxUloyRTRs…

i am using **PHP curl**

> $ch = curl\_init($url);
> 
> ```
> curl_setopt($ch, CURLOPT_HEADER, false);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_POSTFIELDS, ($tokenData));
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded',
> 'Authorization:Basic '. $header_token,
> ));
> 
> $response = curl_exec($ch);
> curl_close($ch);
> 
> ```

please review this and tell me **what is wrong** in this. another thing is **it is working sometime or sometime not.** for safety i replace original Authorization to different Authorization.

i checked process of this generating of Access Token. so i noticed that when i am generating access token fresh ( **Request access token** ) then **Refresh Token** works means i am able to get access token based on refresh token. but after few seconds when again i try to get Access-Token by Refresh token then error i get. i have shared an image. in which first refresh token get when i apply freshly means **Request access token**. 2nd is when i try after few second.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [August 31, 2022, 10:01pm UTC](https://devforum.zoom.us/t/invalid-grant-issue-while-try-to-get-refresh-token/75132/2 "2022-08-31T22:01:16Z")

</div>

Hey @job1608  
Thanks for reaching out to the Zoom developer forum !  
Make sure that you are passing your client ID and client secret as the authorization method when requesting a new access token

---

<div class="post-metadata">

**Author:** ![job1608](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/job1608/32/40539_2.png) [@job1608](https://devforum.zoom.us/u/job1608)\
**Post date:** [September 1, 2022, 12:02pm UTC](https://devforum.zoom.us/t/invalid-grant-issue-while-try-to-get-refresh-token/75132/3 "2022-09-01T12:02:54Z")

</div>

yes , I am sending that. If you check the image file then u can see that both times they are the same.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 9, 2022, 6:07pm UTC](https://devforum.zoom.us/t/invalid-grant-issue-while-try-to-get-refresh-token/75132/4 "2022-09-09T18:07:42Z")

</div>

Hi @job1608  
Have you looked into our Docs here:

> **[OAuth with Zoom](https://marketplace.zoom.us/docs/guides/auth/oauth/#refreshing-an-access-token)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

Note how when you refresh an access token, you will receive a new refresh\_token that then you will use to get a new access\_token when needed.  
Please let me know if this helps  
Elisa
