import React from 'react'; import { AuthConfiguration, AuthorizeResult } from 'react-native-app-auth'; export interface OAuthConfig { login: (params: LoginParams) => Promise; logout: (params: LogoutParams) => Promise; authConfig?: AuthConfiguration; } export interface LoginParams { onSuccess?: (result: AuthorizeResult) => void; onFail?: (error?: any) => void; } export interface LogoutParams { onSuccess?: () => void; onFail?: (error?: any) => void; } /** * Callback function to set the authentication configuration used during * OAuth flows. * * While typically not needed, this function is invoked with the current * access token to be able to provide a dynamic auth configuration. * * @example * { * if (...) { * return { * ...config, * // make auth config change * } * } * return config * }} * /> */ export type AuthConfigGetter = (accessToken?: string) => AuthConfiguration; export declare const OAuthContextProvider: ({ authConfig: authConfigOrGetter, children, }: { authConfig: AuthConfiguration | AuthConfigGetter; children?: React.ReactNode; }) => React.JSX.Element; export declare const useOAuthFlow: () => OAuthConfig;