Sign In | Zoom
Description
Error?
Invalid redirect 4,700
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
1 Like
Thanks Elisa, now when hitting the callback get request with the access_code, i am getting 400,
class ZoomOAuthCallbackView(View):
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
Hi @arsalan.9798
Can you please double check your authorization headers? Id looks like you are encoding and decoding your client id and secret.
I saw a tutorial for node JS ⌠What it should be? Simply just client_id: secret_key ? Or any other encoding
@arsalan.9798 you just need to base64 encode your client id and client secret
I have encoded my request
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())}',
}
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 â}
This is the response
[======response====]
{â_contentâ: bâ{âstatusâ:false,âerrorCodeâ:-1,âerrorMessageâ:âIllegal base64 character 27â,âresultâ:null}',
You are probably doing something wrong when encoding your client id and secret, you are encoding and decoding.
Take a look at these repos:
example.cs
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
example.php
$header = "Authorization: Basic " . base64_encode($username . ':' . $password);
example.py
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
header = ("Authorization: Basic %s" % base64string)
There are more than three files. show original
const express = require('express');
const axios = require('axios');
const qs = require('query-string');
const {
createNewUser, getCurrentUser, getUsers, updateCurrentUserToken, deleteCurrentUser,
} = require('../../dbQuery');
const { decrypt } = require('../../crypto');
const withCurrentUser = require('../../middlewares/withCurrentUser');
const httpErrorHandler = require('../../httpErrorHandler');
const logHttpErrorPath = require('../../logHttpErrorPath');
const {
ZOOM_OAUTH_TOKEN_URL, ZOOM_OAUTH_AUTHORIZATION_URL, ZOOM_API_BASE_URL, ZOOM_TOKEN_RETRIEVED,
ZOOM_USER_REVOKE_ERROR, ZOOM_TOKEN_ERROR, ZOOM_TOKEN_REFRESH_ERROR,
ZOOM_OAUTH_ERROR, ZOOM_FETCH_OAUTH_USERS_ERROR,
} = require('../../constants');
const router = express.Router();
// Zoom OAuth
router.get('/', async (req, res) => {
This file has been truncated. show original
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
Hi @arsalan.9798
Were you able to troubleshoot this further?
No still stuck here , do you have any insight
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:
To publish an app on the Zoom Marketplace you must create an 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 .
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
WâŚ
Yes I did and I am getting the same reply on postman as well
I will send you a private message @arsalan.9798