# Django NGROK zoom integration issue

**URL:** <https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347>\
**Category:** API and Webhooks\
**Created:** [August 14, 2023, 10:08am UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347 "2023-08-14T10:08:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 14, 2023, 10:08am UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/1 "2023-08-14T10:08:03Z")

</div>

* * *

**[Sign In | Zoom](https://zoom.us/oauth/authorize?response_type=code&client_id=00nl0kjuR1a9rCH0u83F1A&redirect_uri=https://49a9-203-81-218-176.ngrok-free.app/zoom/oauth/callback)**

**Description**

- I am developing a django zoom integration , i have exposed the localhost to ngrok, The above link is we are using for oauth authorization, but its returning  
Invalid redirect: [https://49a9-203-81-218-176.ngrok-free.app/zoom/oauth/callback](https://49a9-203-81-218-176.ngrok-free.app/zoom/oauth/callback) (4,700)
- 

**Error?**  
_Invalid redirect 4,700_

---

<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 15, 2023, 4:00pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/2 "2023-08-15T16:00:32Z")

</div>

Hi @arsalan.9798  
Thanks for reaching out to the Zoom Developer forum and welcome to our community.  
Please make sure to add your Redirect URL to the Allow List as well and try again.  
Hope this helps,  
Elisa

---

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 15, 2023, 6:40pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/4 "2023-08-15T18:40:11Z")

</div>

Thanks Elisa, now when hitting the callback get request with the access\_code, i am getting 400,

class ZoomOAuthCallbackView(View):

```auto
def get(self, request):
    code = request.GET.get('code')
    
    token_url = 'https://zoom.us/oauth/token'

    headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': f'Basic {base64.b64encode(f"{settings.CLIENT_ID}: 
                                                          {settings.CLIENT_SECRET}".encode()).decode()}',
    }
    payload = {
        'grant_type' : 'authorization_code',
        'code' : code,
        'redirct_uri' : settings.REDIRECT_URI,
    }
    print(payload)
    response = requests.post(token_url, headers=headers, data=payload)
    
    access_token = response.json().get('access_token')

    return JsonResponse({'access_token':access_token})

```

getting 400 error  
Kindly review if i am doing something wrong  
PS i have stopped ngrok as the above is working for localhost

---

<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 16, 2023, 3:57pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/5 "2023-08-16T15:57:22Z")

</div>

Hi @arsalan.9798  
Can you please double check your authorization headers? Id looks like you are encoding and decoding your client id and secret.

> **[OAuth for user authorized apps](https://developers.zoom.us/docs/integrations/oauth/#getting-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.

---

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 16, 2023, 4:21pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/6 "2023-08-16T16:21:07Z")

</div>

I saw a tutorial for node JS … What it should be? Simply just client\_id: secret\_key ? Or any other encoding

---

<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 16, 2023, 4:25pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/7 "2023-08-16T16:25:07Z")

</div>

@arsalan.9798 you just need to base64 encode your client id and client secret

---

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 16, 2023, 5:04pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/8 "2023-08-16T17:04:14Z")

</div>

I have encoded my request  
def get(self, request):  
code = request.GET.get(‘code’)  
token\_url = ‘[https://zoom.us/oauth/token](https://zoom.us/oauth/token)’  
headers = {  
‘Content-Type’: ‘application/x-www-form-urlencoded’,  
‘Authorization’: f’Basic {base64.b64encode(f"{settings.CLIENT\_ID}:{settings.CLIENT\_SECRET}".encode())}',  
}  
payload = {  
‘grant\_type’ : ‘authorization\_code’,  
‘code’ : code,  
‘redirct\_uri’ : settings.REDIRECT\_URI,  
}  
response = requests.post(token\_url, headers=headers, data=payload)  
access\_token = response.json().get(‘access\_token’)  
print(access\_token)  
return JsonResponse({‘access\_token’:access\_token})

**These are the headers**  
{‘Content-Type’: ‘application/x-www-form-urlencoded’, ‘Authorization’: “Basic b’MDBubDBranVSMWE5ckNIMHU4M0YxQTp6eDVFUkJLTWFtS1pjNWliRXZkajVuU1A3bjVjUTZ2SQ=='”}

**These are the payload**  
{‘grant\_type’: ‘authorization\_code’, ‘code’: ‘bwEj9sgUtY62HPhq16kT8m-pnh4GyeE-g’, ‘redirct\_uri’: ‘[http://localhost:8000/zoom/oauth/callback](http://localhost:8000/zoom/oauth/callback)’}

**This is the response**  
[======response====]  
{‘\_content’: b’{“status”:false,“errorCode”:-1,“errorMessage”:“Illegal base64 character 27”,“result”:null}',

---

<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 16, 2023, 5:15pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/9 "2023-08-16T17:15:46Z")

</div>

> [@arsalan.9798](#):
>
> f’Basic {base64.b64encode(f"{settings.CLIENT\_ID}:{settings.CLIENT\_SECRET}".encode())}',

You are probably doing something wrong when encoding your client id and secret, you are encoding and decoding.

Take a look at these repos:

> <https://gist.github.com/brandonmwest/a2632d0a65088a20c00a>
>
> There are more than three files. show original

> <https://github.com/zoom/user-level-oauth-starter/blob/main/routes/api/zoomOauth.js>

---

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 16, 2023, 5:50pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/10 "2023-08-16T17:50:32Z")

</div>

yup now getting {“reason”:“Invalid Grant”,“error”:“invalid\_grant”} i checked the most common solution is giving the redirecturi in encoded format did that too

---

<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 17, 2023, 5:22pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/11 "2023-08-17T17:22:00Z")

</div>

Hi @arsalan.9798  
Were you able to troubleshoot this further?

---

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 17, 2023, 5:32pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/12 "2023-08-17T17:32:46Z")

</div>

No still stuck here , do you have any insight

---

<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 17, 2023, 5:59pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/13 "2023-08-17T17:59:37Z")

</div>

Did you take a look at the OAuth sample app I shared with you? @arsalan.9798  
Could you try authorizing the app and generating an access token using Postman?  
Here is a very helpful guide on how to do so:

> [@Guide: Making a Zoom API Call with OAuth Credentials in Postman](https://devforum.zoom.us/t/guide-making-a-zoom-api-call-with-oauth-credentials-in-postman/64538):
>
> To publish an app on the Zoom Marketplace you must create an [OAuth app](https://marketplace.zoom.us/docs/guides/build/oauth-app/). When you’re ready to test making API calls, download the latest version of Postman and import the Zoom API collections following the steps outlined [here](https://marketplace.zoom.us/docs/guides/guides/postman/using-postman-to-test-zoom-apis/). There are Three Ways to Set up OAuth in Postman to Make API Requests We’re going to go through three ways to set up our OAuth application credentials to successfully authorize and access the Zoom API to make requests. The “Easy” Difficulty OAuth 2.0 Set Up in Postman We’…

---

<div class="post-metadata">

**Author:** ![arsalan.9798](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/arsalan.9798/32/51073_2.png) [@arsalan.9798](https://devforum.zoom.us/u/arsalan.9798)\
**Post date:** [August 17, 2023, 6:12pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/14 "2023-08-17T18:12:49Z")

</div>

Yes I did and I am getting the same reply on postman as well

---

<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 17, 2023, 6:30pm UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/15 "2023-08-17T18:30:22Z")

</div>

I will send you a private message @arsalan.9798

---

<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:** [August 20, 2024, 10:06am UTC](https://devforum.zoom.us/t/django-ngrok-zoom-integration-issue/93347/16 "2024-08-20T10:06:40Z")

</div>

Closed on August 20, 2024, 10:06am UTC

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