@auth-mate/react
v1.1.0
Published
React authentication library with built-in provider support
Readme
@auth-mate/react
React authentication library with built-in provider support.
Installation
npm install @auth-mate/react
# or
yarn add @auth-mate/react
# or
pnpm add @auth-mate/reactUsage
import { AuthProvider, useAuth } from '@auth-mate/react';
const config = {
providers: {
google: {
clientId: 'your-client-id',
redirectUri: 'http://localhost:3000/callback'
}
}
};
function App() {
return (
<AuthProvider config={config}>
<YourApp />
</AuthProvider>
);
}
function LoginButton() {
const { login, isAuthenticated, user } = useAuth();
if (isAuthenticated) {
return <div>Welcome, {user.name}!</div>;
}
return <button onClick={() => login('google')}>Login with Google</button>;
}Documentation
For full documentation, visit auth-mate.dev. ( coming soon! )
License
MIT
