@auth0/auth0-spa-js
Version:
Auth0 SDK for Single Page Applications using Authorization Code Grant Flow with PKCE
36 lines (35 loc) • 2.1 kB
TypeScript
/**
* @ignore
*/
/**
* Returns a string of unique scopes by removing duplicates and unnecessary whitespace.
*
* @param {...(string | undefined)[]} scopes - A list of scope strings or undefined values.
* @returns {string} A string containing unique scopes separated by a single space.
*/
export declare const getUniqueScopes: (...scopes: (string | undefined)[]) => string;
/**
* @ignore
*/
/**
* We will check if the developer has created the client with a string or object of audience:scopes. We will inject
* the base scopes to each audience, and store the base ones inside default key. As well, if the developer created the Auth0Client
* with a string of scopes, we will store the requested ones with the base scopes inside the default key as well.
* @param authScopes The scopes requested by the user when creating the Auth0Client
* @param openIdScope openId scope
* @param extraScopes Other scopes to accumulate such as offline_access
* @returns {Record<string, string>} An object with all scopes that are going to be accumulated.
*/
export declare const injectDefaultScopes: (authScopes: string | Record<string, string> | undefined, openIdScope: string, ...extraScopes: string[]) => Record<string, string>;
/**
* @ignore
*/
/**
* Will return a string of scopes. If a specific audience was requested and it exist inside the scopes object, we will return those
* related to that audience that we want to accumulate. If not, we will return the ones stored inside the default key.
* @param authScopes Object of audience:scopes that are going to be accumulated
* @param methodScopes The scopes requested for the developer in a specific request
* @param audience The audience the developer requested for an specific request or the one they configured in the Auth0Client
* @returns {string} A combination of Auth0Client scopes and the ones requested by the developer for a specific request
*/
export declare const scopesToRequest: (authScopes: Record<string, string>, methodScopes: string | undefined, audience: string | undefined) => string;