react-native-app-auth-fork
Version:
React Native bridge for AppAuth for supporting any OAuth 2 provider
63 lines (53 loc) • 1.53 kB
TypeScript
export interface ServiceConfiguration {
authorizationEndpoint: string;
tokenEndpoint: string;
revocationEndpoint?: string;
registrationEndpoint?: string;
}
export type BaseAuthConfiguration =
| {
clientId: string;
issuer?: string;
serviceConfiguration: ServiceConfiguration;
}
| {
clientId: string;
issuer: string;
serviceConfiguration?: ServiceConfiguration;
};
interface BuiltInParameters {
display?: "page" | "popup" | "touch" | "wap";
login_prompt?: string;
prompt?: "consent" |"login" | "none" | "select_account";
}
export type AuthConfiguration = BaseAuthConfiguration & {
clientSecret?: string;
scopes: string[];
redirectUrl: string;
additionalParameters?: BuiltInParameters & { [name: string]: string };
dangerouslyAllowInsecureHttpRequests?: boolean;
};
export interface AuthorizeResult {
accessToken: string;
accessTokenExpirationDate: string;
additionalParameters?: { [name: string]: string };
idToken: string;
refreshToken: string;
tokenType: string;
}
export interface RevokeConfiguration {
tokenToRevoke: string;
sendClientId?: boolean;
}
export interface RefreshConfiguration {
refreshToken: string;
}
export function authorize(config: AuthConfiguration): Promise<AuthorizeResult>;
export function refresh(
config: AuthConfiguration,
refreshConfig: RefreshConfiguration
): Promise<AuthorizeResult>;
export function revoke(
config: BaseAuthConfiguration,
revokeConfig: RevokeConfiguration
): Promise<void>;