cancel
Showing results for 
Search instead for 
Did you mean: 

get access token in my app "error": "400 Client Error: Bad Request for url: https://zoom.us/oauth/to

aneesraza
Newcomer
Newcomer
@api.get("/oauth/callback", tags=['Integrations'])
async def callback(request: Request):
    authorization_code = request.query_params.get('code')
    token_url = 'https://zoom.us/oauth/token'

    payload = {
        'grant_type': 'authorization_code',
        'code': authorization_code,
        'client_id': CLIENT_ID,
        'client_secret': CLIENT_SECRET,
        'redirect_uri': REDIRECT_URI
    }

    try:
        response = requests.post(token_url, data=payload)
        response.raise_for_status()
        access_token = response.json().get('access_token')
        print ("Access token: ", access_token)
        if access_token:
            # Save the access token in your database or perform any other required actions
            return {'access_token': access_token}
        else:
            return {'error': 'Access token not found'}
    except requests.exceptions.HTTPError as e:
        return {'error': str(e)}
1 REPLY 1

Ray_Harwood
Community Champion | Customer
Community Champion | Customer

Welcome to the Zoom Community, @aneesraza 

 

This is a question more appropriate for the Developers Forum at https://developers.zoom.us/


Ray - Need Zoom Events/Sessions Help? Visit Z-SPAN.com.
Please click Accept As Solution if this helped you !