v1.3.0-beta/start of voice call and custom code:

This commit is contained in:
Ayushya Amitabh
2020-05-29 17:43:10 -04:00
parent 2053c2860a
commit ccd7f1cfab
15 changed files with 396 additions and 123 deletions
+20
View File
@@ -0,0 +1,20 @@
const VoxeetSecret = require('../VoxeetSecret.json');
module.exports = async (req, res) => {
const { key, secret } = VoxeetSecret;
const credentials = btoa(encodeURI(key) + ':' + encodeURI(secret));
const headers = {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
Authorization: 'Basic ' + credentials,
};
const oauth = await fetch(VoxeetSecret.validateURL, {
method: 'POST',
headers,
body: JSON.stringify({
grant_type: 'client_credentials',
}),
})
.then((oauthResponse) => oauthResponse.json())
.catch((err) => res.status(500).send(err));
if (oauth) res.status(200).send(oauth);
};