@auth0/nextjs-auth0
Version:
Auth0 Next.js SDK
26 lines (25 loc) • 1.46 kB
TypeScript
import { AuthorizationParameters } from "../types/index.js";
/**
* Determines the default scope based on the provided authorization parameters.
* If no scope is defined, it defaults to a predefined set of scopes.
* If the scope is defined as an object (map) and does not include a scope for the default audience,
* it adds the default scopes for that audience.
* @param authorizationParameters The authorization parameters to evaluate.
* @returns The determined scope, either as a string or an updated map of scopes.
*/
export declare function ensureDefaultScope(authorizationParameters: AuthorizationParameters): string | {
[key: string]: string;
};
/**
* Retrieves the appropriate scope for a given audience from a scope map.
* Only considers the audience when the scope is of type Map<string, string>.
* If the scope is a string, it is returned as-is.
* If the scope is null or undefined, undefined is returned.
* @param scope The scope, either as a string, null/undefined, or a Map of audience to scope.
* @param audience The audience to look up in the scope map
* @returns The scope string for the given audience, or undefined if not found or if scope is null/undefined.
* @throws {InvalidConfigurationError} If scope is defined as a map but no audience is provided.
*/
export declare function getScopeForAudience(scope: string | null | undefined | {
[key: string]: string;
}, audience: string | null | undefined): string | undefined;