Closed mobeendev closed 3 years ago
How did you retrieve zoomAccessToken
?
@mieszko4 I have this script where I allow use php to generate access token:
`<?php
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
require_once 'config.php';
$url = "https://zoom.us/oauth/authorize?response_type=code&client_id=".CLIENT_ID."&redirect_uri=".REDIRECT_URI; ?>
`
after authentication from above, I get this url // callback url
https://mydomain.com/staging/zoom-integration/callback.php?code=FROM-ZOOM-CODE-JdoJzEQ
and here's the callback script:
`<?php require_once 'config.php';
try { $client = new GuzzleHttp\Client(['base_uri' => 'https://zoom.us']);
$response = $client->request('POST', '/oauth/token', [
"headers" => [
"Authorization" => "Basic ". base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
],
'form_params' => [
"grant_type" => "authorization_code",
"code" => $_GET['code'], --------------------------This is the code with which I am making call to /oauth/token
--------------------------------to generate access token
"redirect_uri" => REDIRECT_URI
],
]);
$token = json_decode($response->getBody()->getContents(), true);
print_r($token);
die('done');
} catch(Exception $e) { echo $e->getMessage(); }`
so this returns the access token / zak
@mieszko4 how would you suggest me to make an access token, so that I can initiate the meeting from mobile app.
I think this route not for zak creation.
We create zak from users route:
const result = await client.get(`/users/${user_id}/token`, {
params: { type: 'zak' }, // query
})
return result.data.token
I will try to update the example with fetching zak
https://github.com/mieszko4/react-native-zoom-us-test so maybe that will help.
@mieszko4 yes that would be so nice. Also I noticed that you are giving zak for userId, is that required!
const startMeeting = async () => {
try {
const startMeetingResult = await ZoomUs.startMeeting({
userName: 'John',
meetingNumber: exampleMeeting.meetingNumber,
userId: exampleMeeting.zoomAccessToken, <<----------------------------
zoomAccessToken: exampleMeeting.zoomAccessToken, <<----------------------------
});
console.log({startMeetingResult});
} catch (e) {
Alert.alert('Error', 'Could not execute startMeeting');
console.error(e);
}
};
@mieszko4 I solved this issue, actually I was using Access Token which I was getting after OAuth from server-side authentication. that token is used to make API calls to create meetings/list meetings/see user/ view rooms etc.
The zoom access token is obtained if we retrieve meeting information from this API and in the headers of this request we'll pass above OAuth Access Token :
{{baseUrl}}/meetings/94975163239
{
"uuid": "pTLY+5h/QMCxUYUj+HSpBg==",
"id": 94975163239,
"host_id": "Mo3adfQ7elf1UJdoJzEQ",
"host_email": "mobeen@mydomain.com",
"assistant_id": "",
"topic": "Integrate zoom APIs",
"type": 2,
"status": "waiting",
"start_time": "2020-12-24T17:30:00Z",
"duration": 30,
"timezone": "Asia/Qatar",
"agenda": "",
"created_at": "2020-10-11T09:24:08Z",
"start_url": "https://zoom.us/s/94975163239?zak=eyJ6bV9za20iOiJ6bV9vMm0iLCJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjbGllbnQiLCJ1aWQiOiJNb0xQSlJoZFE3ZWxmMVVKZG9KekVRIiwiaXNzIjoid2ViIiwic3R5IjoxMDAsIndjZCI6ImF3MSIsImNsdCI6MCwic3RrIjoiZjk1YWFlQ01qakROZjVzUk1Vcl9TM3lRNXowMzF5WWRKZjUwazJsSmczRS5CZ1VnUlM5V2VVVTViM2xhUkU1VVZtVkROVVUwV0V0YU9Dc3phRnBsYjFkamRsSkFOelkzWlRreU5tVTNaV0kzWkRnMk9UVXlOMkV5T1dZeE5UWTBZamcyTkRjMllUQXlNMlpqTm1Zd05UQTJOVEU1TkRkbVltRXpaREkzTUdWaE5HVTNPQUFNTTBOQ1FYVnZhVmxUTTNNOUFBTmhkekUiLCJleHAiOjE2MDU2OTU2MjIsImlhdCI6MTYwNTY4ODQyMiwiYWlkIjoiY0pNWlpiMnRRdjZHVmNEOC12bVJ2ZyIsImNpZCI6IiJ9.snrNvXgQUCzI7dFYpF855TlxzpPXYN2boUe00pfiQg4",
"join_url": "https://zoom.us/j/99676269266?pwd=QVpEblNwa3FRbzc0OGdFTlFYaFZiZz09",
"password": "123456",
"h323_password": "123456",
"pstn_password": "123456",
"encrypted_password": "QVpSidfei1l2k3jGdFTlFYaFZiZz09",
"settings": {
"host_video": false,
"participant_video": false,
"cn_meeting": false,
"in_meeting": false,
"join_before_host": false,
"mute_upon_entry": false,
"watermark": false,
"use_pmi": false,
"approval_type": 2,
"audio": "voip",
"auto_recording": "none",
"enforce_login": false,
"enforce_login_domains": "",
"alternative_hosts": "",
"close_registration": false,
"show_share_button": false,
"allow_multiple_devices": false,
"registrants_confirmation_email": true,
"waiting_room": true,
"request_permission_to_unmute_participants": false,
"registrants_email_notification": true,
"meeting_authentication": false,
"encryption_type": "enhanced_encryption"
}
}
above response contains the start_url and zak as shown below:
"start_url": "https://zoom.us/s/94975163239?zak=eyJ6bV9za20iOiJ6bV9vMm0iLCJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjbGllbnQiLCJ1aWQiOiJNb0xQSlJoZFE3ZWxmMVVKZG9KekVRIiwiaXNzIasdfasjh1k2h3kj1hl3jViM2xhUkU1VVZtVkROVVUwV0V0YU9Dc3phRnBsYjFkamRsSkFOelkzWlRreU5tVTNaV0kzWkRnMk9UVXlUiLCJleHAiOjE2MDU2OTU2MjIsImlhdCI6MTYwNTY4ODQyMiwiYWlkIjoiY0pNWlpiMnRRdjZHVmNEOC12bVJ2ZyIsImNpZCI6IiJ9.snrNvXgQUCzI7dFYpF855TlxzpPXYN2boUe00pfiQg4",
we need to extract that zak value and pass to the await ZoomUs.startMeeting method.
it will then work fine.
Great, thnx @mobeendev That will definitely inspire me to integrate it in the example app.
Welcome @mieszko4 🌟
@mieszko4 , @zvs001 I have integrated the SDK successfully and I can join the meeting.
However, I can not start the meeting as host: if I invoke the start meeting function it asks for the password as shown below:
and after entering the password it doesn't make me host as you can see below:
Here is the function call
async start() { try {
}