UNPKG

@charmr/oauth-button

Version:

A lightweight, OAuth login button for React, designed to work seamlessly with the `@charmr/oauth-core` controller. Supports Google, Facebook (implicit flow), and GitHub (authorization code flow)

13 lines (12 loc) 548 B
import { jsx as _jsx } from "react/jsx-runtime"; import { useController } from '@charmr/oauth-core'; export const OAuthLoginButton = ({ provider, clientId, redirectUri, buttonText = `Continue with ${provider}`, onSuccess, onError, className, style }) => { const { startLogin } = useController({ provider: provider, clientId: clientId, redirectUri: redirectUri, onSuccess, onError, }); return (_jsx("button", { className: className, style: style, onClick: startLogin, children: buttonText })); };