@streambird/streambird-js
Version:
45 lines (44 loc) • 1.83 kB
TypeScript
import { Session } from '../models';
import { AbstractService } from './abstract-service';
declare type VerifyRequest = {
/**
* Required OAuthToken provided to the login/signup redirect url to authenticate the OAuth
* session and exchange user info and idp access token and refresh token
*/
token: string;
/**
* Optional type of session for this oauth request. When idp is used, the idp provider's
* access token and refresh token will be returned under idpSession property while a
* session session type means a Streambird managed "session", "sessionToken" and
* "sessionExpiresIn" will be used if present.
* Possible values: idp, session, defaults to session.
*/
sessionType?: string;
/**
* Optional expire time in minutes. Only used if sessionType is "session". Extend the
* session expiration time to N minutes from now, must be between
* 5 to 525600 minutes (365 days).
*/
sessionExpiresIn?: number;
};
declare type VerifyResponse = {
providerSubject: string;
provider: 'google' | string;
userId: Session['userId'];
session: Session;
sessionToken: string;
sessionJwt: string;
idpSession?: string | null;
};
export declare class OAuthService extends AbstractService {
url: string;
/**
* Verify an internal OAuth token redirected to your application upon the completion of the OAuth flow.
* This token is generated by Streambird and can be used to exchange for the authenticated user
* information and/or the original access token and refresh token of the idp providers that can be
* used directly with the external OAuth providers (e.g., Google, Apple, Microsoft, etc).
* @returns sessions data
*/
verify(body: VerifyRequest): Promise<VerifyResponse>;
}
export {};