@yash101/schwab-api-client
Version:
A TypeScript client library for interacting with the Charles Schwab Brokerage APIs.
43 lines • 1.52 kB
TypeScript
import { AuthTokens } from './tokens';
import { AppConfig } from './appconfig';
/**
* Exchanges an authorization code for initial authentication tokens.
*
* @param authCode - The authorization code received from the authorization server.
* Ensure this is URL-decoded before passing it to this function.
* @param clientId - The client ID of the application.
* @param clientSecret - The client secret of the application.
* @param redirectUri - The redirect URI used during the authorization process.
* @param apiUri - (Optional) The base URI of the API endpoint.
*
* @returns A promise that resolves to an `AuthTokens` object containing the access token,
* refresh token, and their respective expiration times.
*
* @throws Will throw an error if the API call to exchange the authorization code fails.
*/
export declare function getInitialTokensFromAuthorizationCode({ authCode, appConfig, apiUri }: {
authCode: string;
appConfig: AppConfig;
apiUri?: string;
}): Promise<{
accessToken: string;
refreshToken: string;
accessTokenExpiresAt: Date;
refreshTokenExpiresAt: Date;
type: string;
scope: string;
id_token: string;
}>;
export declare function getNewAccessToken({ authTokens, appConfig, apiUri }: {
authTokens: AuthTokens;
appConfig: AppConfig;
apiUri?: string;
}): Promise<{
accessToken: string;
refreshToken: string;
accessTokenExpiresAt: Date;
type: string;
scope: string;
id_token: string;
}>;
//# sourceMappingURL=auth.d.ts.map