v1.6.0/admin only mode

This commit is contained in:
2020-08-01 13:53:58 -04:00
parent 8d8cf6d276
commit 9c600f383d
15 changed files with 197 additions and 88 deletions
+17 -18
View File
@@ -1,21 +1,20 @@
const VoxeetSecret = require('../VoxeetSecret.json');
module.exports = async (req, res) => {
res.status(403).send({ message: 'Voice calls are unavailable temporarily.' });
// 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.refreshURL, {
// method: 'POST',
// headers,
// body: JSON.stringify({
// refresh_token: req.params.token,
// }),
// })
// .then((oauthResponse) => oauthResponse.json())
// .catch((err) => res.status(500).send(err));
// if (oauth) res.status(200).send(oauth);
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.refreshURL, {
method: 'POST',
headers,
body: JSON.stringify({
refresh_token: req.params.token,
}),
})
.then((oauthResponse) => oauthResponse.json())
.catch((err) => res.status(500).send(err));
if (oauth) res.status(200).send(oauth);
};