You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 780B

1234567891011121314151617181920212223242526272829
  1. // @flow
  2. import { getJitsiMeetGlobalNS } from '../util';
  3. /**
  4. * Executes the oauth flow.
  5. *
  6. * @param {string} authUrl - The URL to oauth service.
  7. * @returns {Promise<string>} - The URL with the authorization details.
  8. */
  9. export function authorize(authUrl: string): Promise<string> {
  10. const windowName = `oauth${Date.now()}`;
  11. const gloabalNS = getJitsiMeetGlobalNS();
  12. gloabalNS.oauthCallbacks = gloabalNS.oauthCallbacks || {};
  13. return new Promise(resolve => {
  14. const popup = window.open(authUrl, windowName);
  15. gloabalNS.oauthCallbacks[windowName] = () => {
  16. const returnURL = popup.location.href;
  17. popup.close();
  18. delete gloabalNS.oauthCallbacks.windowName;
  19. resolve(returnURL);
  20. };
  21. });
  22. }