import { OAuthConfig } from './types/OAuthConfig'; import { Token } from './types'; /** * Returns URI to request authorization code with the given parameters. * * @param authorizationEndpoint string * @param clientId string * @param redirectUri string * @param queryParams {} optional * @returns {string} */ declare function createAuthCodeRequestUri(authorizationEndpoint: string, clientId: string, redirectUri: string, queryParams?: {}): string; /** * Makes a request to the `tokenInfoUrl` to validate the given `accessToken`. * Resolves with an object containing access token information in case of success. * Otherwise, rejects with an error message. * * @param tokenInfoUrl * @param accessToken * @returns {Promise} */ declare function getTokenInfo(tokenInfoUrl: string, accessToken: string): Promise; /** * Helper function to get an access token for the specified scopes. * Reads client and user credentials (to build a valid authorization header) and makes a * request to the `accessTokenEndpoint`. * * Resolves with object containing property `accessToken` with the access token * (in case of success). Otherwise, rejects with error message. * * Currently supports the following OAuth flows (specified by the `grantType` property): * - Resource Owner Password Credentials Grant (PASSWORD_CREDENTIALS_GRANT) * - Authorization Code Grant (AUTHORIZATION_CODE_GRANT) * - Refresh Token Grant (REFRESH_TOKEN_GRANT) * * The `options` object can have the following properties: * - credentialsDir string * - grantType string * - accessTokenEndpoint string * - scopes string[] optional * - queryParams {} optional * - redirect_uri string optional (required with AUTHORIZATION_CODE_GRANT) * - code string optional (required with AUTHORIZATION_CODE_GRANT) * - refreshToken string optional (required with REFRESH_TOKEN_GRANT) * * @param options * @returns {Promise} */ declare function getAccessToken(options: OAuthConfig): Promise; export { getTokenInfo, getAccessToken, createAuthCodeRequestUri };