UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

24 lines 1.27 kB
/** * Generates an authorization URL for either login or webhook requests, * including scopes, state, and redirect URIs. This URL can be used in OAuth2 * authentication flows, such as logging in or connecting a webhook. * * @function * @param {Record<string, any>} tinyCfg - The configuration object containing the app's OAuth2 settings. * @param {Record<string, any>} jsonState - The state object to be encrypted and passed in the authorization URL. * @param {Record<string, any>} tinyCrypto - The crypto object used to encrypt the state. * @param {string} type - The type of the request, which determines the URL generation process. * Can be `'login'`, `'login_command'`, or `'webhook'`. * * @returns {string} The generated authorization URL for OAuth2 authorization. * * @example * const authUrl = authURLGenerator(tinyCfg, jsonState, tinyCrypto, 'login'); * console.log(authUrl); * * @example * const webhookAuthUrl = authURLGenerator(tinyCfg, jsonState, tinyCrypto, 'webhook'); * console.log(webhookAuthUrl); */ export default function authURLGenerator(tinyCfg: Record<string, any>, jsonState: Record<string, any>, tinyCrypto: Record<string, any>, type: string): string; //# sourceMappingURL=authURLGenerator.d.mts.map