UNPKG

bungie-net-core

Version:

An easy way to interact with the Bungie.net API

32 lines (31 loc) 1.41 kB
import { BungieHttpProtocol } from '.'; /** * Creates an authentication URL for users to click * * @param state An opaque value used by the client to maintain state between the request and the callback. The parameter should be used for preventing cross-site request forgery as described in section 10.12 of the OAuth 2.0 specification. {@link https://auth0.com/docs/protocols/state-parameters} * @param redirect_uri If it is present, it must be a case sensitive exact match with the value registered in the portal. * @param reauth Default's to false. Forces the user to re-authorize with Bungie * @param client_id Provided by the portal * @see {@link https://github.com/Bungie-net/api/wiki/OAuth-Documentation} */ export declare function createOAuthURL(query: { client_id: string; redirect_uri?: string; state?: string; reauth?: boolean; }): URL; export type BungieTokensResponse = { membership_id: string; access_token: string; expires_in: number; refresh_token: string; refresh_expires_in: number; }; export declare function authorize(code: string, credentials: { client_id: string; client_secret: string; }, http: BungieHttpProtocol): Promise<BungieTokensResponse>; export declare function refreshAuthorization(token: string, credentials: { client_id: string; client_secret: string; }, http: BungieHttpProtocol): Promise<BungieTokensResponse>;