@app-connect/core 1.7.0-beta.1 → 1.7.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +17 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1500,6 +1500,23 @@ function createCoreRouter() {
|
|
|
1500
1500
|
});
|
|
1501
1501
|
});
|
|
1502
1502
|
|
|
1503
|
+
router.get('/ringcentral/oauth/callback', async function (req, res) {
|
|
1504
|
+
const jwtToken = req.query.jwtToken;
|
|
1505
|
+
if (jwtToken) {
|
|
1506
|
+
const unAuthData = jwt.decodeJwt(jwtToken);
|
|
1507
|
+
const { code } = req.query;
|
|
1508
|
+
const user = await UserModel.findByPk(unAuthData?.id);
|
|
1509
|
+
if (!user) {
|
|
1510
|
+
res.status(400).send('User not found');
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
await authCore.onRingcentralOAuthCallback({ code, rcAccountId: user.rcAccountId });
|
|
1514
|
+
res.status(200).send('OK');
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
res.status(400).send('Invalid request');
|
|
1518
|
+
});
|
|
1519
|
+
|
|
1503
1520
|
if (process.env.IS_PROD === 'false') {
|
|
1504
1521
|
router.post('/registerMockUser', async function (req, res) {
|
|
1505
1522
|
const secretKey = req.query.secretKey;
|