<LoginForm>
Similar to the <Form> component but optimized to easily introduce login, signup, and onboarding functionality into your custom app.
Overview
Use <LoginForm />
instead of <Form /> to display your login & signup flow. It provides critical authentication-related logic, including:
For logged out users, show the login or signup step of your flow. Prevent users from accessing your authenticated app until they log in.
Once a user logs in, display either the first-time onboarding flow (if included in your login form) or the authenticated part of your custom app.
(Optional) Automatically log the user out of the application after their session expires after a period of inactivity.
How to Build a Login Flow in Feathery
Tutorial: How to Embed Your Login Flow
Example Code
<LoginForm />
formProps
authId
optional string
The user's authentication token. Setting this denotes the user as logged in
and will track their authenticated account information.
authClient
optional instance of auth SDK
loader
optional JSX component
A custom loader to show while waiting for auth network calls and, if applicable, your onLogin
call. If not provided, a default spinner will be used.
loginPath
optional string
OAuth 2.1 requires login paths to be whitelisted, so this prop allows you to specify a path you've whitelisted in your auth provider that the user should be directed to when showing the login flow. Defaults to /
onClientReady
optional function
A callback function that runs after the auth SDK has been initialized. The function passes the SDK client as the single parameter.
onLogin
optional async function
A callback function that runs after the user has been successfully authenticated. This function will run to completion before the provider children
are rendered, so you can load anything your application needs here.
onLogout
optional function
A callback function that runs after the user has logged out.
children
optional JSX components
Pass the authenticated portion of your app as children
of the LoginProvider
component. You can also pass no children
if you just want to render the login flow with no protected resource.
Last updated