Description
I am trying to use the API for server-to-server Oath create of a meeting and provide the meeting link to my user. To create the meeting I’m making a OkHttp call to url https://api.zoom.us/v2/users/me/meetings.
See my code example below. Note the call to get the token works just fine.
Error
When I try to make the call this is the error I get when running the meeting request:
{protocol=h2, code=401, message=, url=https://api.zoom.us/v2/users/me/meetings}
How To Reproduce
This is my code snip
private String zoomTokenGenerate() throws Exception
{
// ============== this is the line that produces the error
Response response = client.newCall(request).execute();
//===============
String responseBody = response.body().string();
An HTTPS Error 401 indicates to me that your auth header is incorrect. Looking at this line:
In my application, the grant_type I’m using is account_credentials not client_credentials, so give that a shot.
EDIT: Just to add, I’m also specifying my account ID in the request, which I don’t see in yours: oauth/token?grant_type=account_credentials&account_id=${MY_ZOOM_ACCOUNT_ID}
No worries. I’m suggesting you try replacing “client_credentials” with “account_credentials”, and also appending your request to add “account_id” with the appropriate info. Good luck!
Thank you. That worked. Now I’m having an issue with the meeting link that was generated / created. It makes a meeting but I need the meeting to be setup so that the first person that clicks the link becomes the host or set it up as a no host meeting. Do you have any ideas on how I can do that? Thanks in advance.
Hi Glenn glad to hear you overcame the auth issue.
When you successfully create a meeting, you should receive a JSON object back that, among other things, contains properties join_url and start_url; The person you want to be the host should use the start_url and the other guest(s) use should the join_url. You may want to subsequently set join_before_host: false in your meeting creation parameters.
Thanks for your continued assist on this. You have been great so far. I tried your latest suggestion and both the start_url and join_url come out the same.
These are my current start settings:
JSONObject bodyProps = new JSONObject();
bodyProps.put(“topic”,“Test Meeting 2”);
bodyProps.put(“type”, 2); // Scheduled meeting
bodyProps.put(“alternative_hosts”,“”);
bodyProps.put(“participant_join_before_host”,false);
bodyProps.put(“duration”,15);
bodyProps.put(“settings”,new JSONObject().put(“host_video”,true).put(“participant_video”,true));
Just messing around with options. This is what I have set now and it still is gives a “waiting” for host when I join:
JSONObject bodyProps = new JSONObject();
bodyProps.put(“topic”,“Test Meeting 4”);
bodyProps.put(“type”,1); // 2 = Scheduled meeting; 1 = Instant Meeting
bodyProps.put(“alternative_hosts”,“”);
bodyProps.put(“schedule_type”,“personal”);
bodyProps.put(“participant_join_before_host”,true);
bodyProps.put(“waiting_room”,false);
bodyProps.put(“duration”,15);
bodyProps.put(“settings”,new JSONObject().put(“host_video”,true).put(“participant_video”,true));
Bear in mind there’s some functions in there from the javascript library date-fns (sub() and format()) that I’m using to make the start time be now-minus-1-minute for my own weird use case, you can ignore. But this should be helpful.
Just adding to what Alex shared, there is a setting in your Zoom Account that must be enabled manually to be able to set the “join_before_host” to true.
Head over to the Admin Tab > Account Management > Account settings > Meeting > Schedule meeting > “Allow participants to join before host”
Thank you for the help. This has worked. Now all I need to do is figure out how to get it to not send an e-mail to me every time the meeting attendees join the meeting. If you have any idea on that it would be great. Thanks again.
Thank you. I was trying to figure out how to do it on a meeting by meeting basis through the API. But, changing that made it work and since the account in question will only be creating meetings via the API it will work for me.
Didn’t seem to work. I found something online that said it should be notification_email: false instead. But, that didn’t work either. But, I just went into my Zoom account and changed the setting for all meetings on that user account and it appears to have worked. Simple solution for me because the account in question is only going to be used for the API meeting creates.