Add jwt module to react

This commit is contained in:
Ilya Daynatovich
2017-04-21 13:00:50 +03:00
committed by Lyubo Marinov
parent 4f72225372
commit ab5c2e9ded
20 changed files with 356 additions and 222 deletions

View File

@@ -7,35 +7,29 @@ import {
/**
* Implements external connect using createConnectionExternally function defined
* in external_connect.js for Jitsi Meet. Parses the room name and token from
* the URL and executes createConnectionExternally.
* in external_connect.js for Jitsi Meet. Parses the room name and JSON Web
* Token (JWT) from the URL and executes createConnectionExternally.
*
* NOTE: If you are using lib-jitsi-meet without Jitsi Meet you should use this
* NOTE: If you are using lib-jitsi-meet without Jitsi Meet, you should use this
* file as reference only because the implementation is Jitsi Meet-specific.
*
* NOTE: For optimal results this file should be included right after
* external_connect.js.
*/
const hashParams = parseURLParams(window.location, true);
if (typeof createConnectionExternally === 'function') {
// URL params have higher proirity than config params.
let url
= parseURLParams(window.location, true, 'hash')[
'config.externalConnectUrl']
|| config.externalConnectUrl;
let roomName;
// URL params have higher proirity than config params.
let url = hashParams['config.externalConnectUrl'] || config.externalConnectUrl;
if (url && window.createConnectionExternally) {
const roomName = getRoomName();
if (roomName) {
if (url && (roomName = getRoomName())) {
url += `?room=${roomName}`;
let token = hashParams['config.token'] || config.token;
const token = parseURLParams(window.location, true, 'search').jwt;
if (!token) {
const searchParams
= parseURLParams(window.location, true, 'search');
token = searchParams.jwt;
}
if (token) {
url += `&token=${token}`;
}