2017-05-26 22:11:33 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2020-05-07 22:26:37 +00:00
|
|
|
import { parseURLParams } from '../util';
|
2017-05-26 22:11:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the JSON Web Token (JWT), if any, defined by a specific
|
|
|
|
* {@link URL}.
|
|
|
|
*
|
|
|
|
* @param {URL} url - The {@code URL} to parse and retrieve the JSON Web Token
|
|
|
|
* (JWT), if any, from.
|
|
|
|
* @returns {string} The JSON Web Token (JWT), if any, defined by the specified
|
|
|
|
* {@code url}; otherwise, {@code undefined}.
|
|
|
|
*/
|
|
|
|
export function parseJWTFromURLParams(url: URL = window.location) {
|
|
|
|
return parseURLParams(url, true, 'search').jwt;
|
|
|
|
}
|