Error:400,{"reason":"Invalid client_id or client_secret","error":"invalid_client"}

i created a new app for Oauth and i added properly the client ID and client secret but i am still getting this error.
i am using python flask and this is my code, any help would be appreciated
@app.route(‘/create_meeting’, methods=[‘GET’, ‘POST’])
def create_meeting():
topic = “Create Meeting”
patient_name = session.get(‘pt_name_booked’)
doctor_email = session.get(‘doc_email’)
slot_duration = session.get(‘slot_duration’)
start_time = session.get(‘start_time’)
current_timestamp = round(time.time())
iat = current_timestamp
exp = iat + (60 * 60 * 2)
authorization_url = f"{AUTHORIZE_URL}?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}"
print(authorization_url)
return f"Click here to authorize Zoom "

@app.route(‘/oauth/callback’)
def oauth_callback():
code = request.args.get(‘code’)
credentials = f"{CLIENT_ID}:{CLIENT_SECRET}"
base64_credentials = base64.b64encode(credentials.encode()).decode()

headers={
    'Authorization':base64_credentials,
    'Content-Type': 'application/x-www-form-urlencoded'
}
payload={
    'code':code,
    'grant_type':'authorization_code',
    'redirect_uri':REDIRECT_URI,

}
response = requests.post(TOKEN_URL,headers=headers,data=payload)
if response.status_code==200:
    access_token = response.json().get('access_token')
    return f"Access token received:{access_token}"
else:
    return f"Error:{response.status_code},{response.text}"

HI @johny.achkar01
Thanks for reaching out to us…
Have you been able to troubleshoot this on your end?
If not, can you please confirm that you are generating your access token correctly?

Hi Elisa , thank you for your reply. the above error is now solved but i have a question … i am a beginner and appreciate any help.
when i submit a form from the client side along with the request for user authorization as an ajax request. the ajax , when delayed to get a response that include the zoom link does not work. what is the best way to schedule an appointment that shows the zoom link on a calendar.
this is my ajax request but it does not work coz i have to wait for the authorization then the zoom link to send it to the client side appointment schedule.
const saveButton = document.querySelector(“#save-button”);
const hiddenInput = document.getElementById(“submit-input”)
saveButton.addEventListener(“click”, function (event) {
event.preventDefault();
$.ajax({
type: ‘POST’,
url: ‘/book_appointment’,
data: $(‘#appointment-form’).serialize(),
dataType: ‘json’,
success: function (response) {
console.log(response)
var eventData = {
id: response.gener_id,
title: ‘Booked Appointment’,
start: response.start_time,
end: response.end_time,
extendedProps: {
patientName: response.patient_name,
family: response.patient_family_name,
zoom_link:response.zoom_link

                    }
                };

Hi @johny.achkar01
I do not think you can make API requests on the client side, this should be managed in your backend.

Hi Johny can you tell me the solution for the encoding you did in python

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