ai-auth
Version:
Complete Auth-Agent SDK - Agent authentication for AI developers + OAuth client integration for website developers
36 lines • 1.08 kB
TypeScript
/**
* React Context for Auth-Agent authentication
*/
import React, { ReactNode } from 'react';
import { AuthAgentClient } from '../client';
import type { AuthConfig, AuthState, UserInfo, AuthError } from '../types';
interface AuthContextValue extends AuthState {
client: AuthAgentClient;
login: (options?: {
state?: string;
scope?: string;
}) => Promise<void>;
logout: () => void;
refreshToken: () => Promise<void>;
getAccessToken: () => string | null;
}
export interface AuthProviderProps {
config: AuthConfig;
children: ReactNode;
onRedirectCallback?: (result: {
user?: UserInfo;
error?: AuthError;
}) => void;
}
/**
* AuthProvider component
* Wrap your app with this to enable Auth-Agent authentication
*/
export declare function AuthProvider({ config, children, onRedirectCallback }: AuthProviderProps): React.JSX.Element;
/**
* useAuth hook
* Access authentication state and methods
*/
export declare function useAuth(): AuthContextValue;
export {};
//# sourceMappingURL=AuthContext.d.ts.map