Login Embed Tutorial

Step-by-step guide to adding a login, signup, and onboarding flow to your website.

Overview

Feathery is the easiest way to add login and signup functionality to your React app. This guide will get you started with a login form that wraps around a demo app via create-react-app.

Afterwards, you will have a working React app with:

  • Customized login and sign up flow, complete with post-login onboarding questions

  • Secure, password-less email magic link sign up and login

  • Google One Tap signup and login

Before you start

You need to set up a Feathery form with login functionality or use one of our prebuilt login templates. For this guide, we'll use the SaaS Signup and Onboarding template. If you do not use this template, you will need to configure your form to work with Stytch by following these instructions.

Want to skip to the end? Check out our example app.

But make sure to still replace the SDK key and form name placeholders with your own!

1. Create your new React app

The most common way to create a starter app is with the CLI tool create-react-app.

npx create-react-app login-provider-demo

2. Install Feathery

Once your starter app is generated, navigate to the directory that you just created. Then run the following command to install Feathery.

3. Initialize Feathery

Next, create a file src/FeatheryConfig.js and declare the following two variables with their appropriate values:

Open src/index.js and add the following code to initialize Feathery.

4. Add <LoginForm />

Include your login flow via the LoginForm component, and pass the authenticated portion of your application as children of the LoginForm. Edit your src/App.js file to match this.

The <LoginForm /> component will render its children components after the user has logged in.

You're done! You now have an authenticated dashboard application accessible via a Feathery login flow.

Example: Add Routing to Login App

As an example of what a functional React app with both login and URL routing might look like, we will include a basic URL router.

Now, add it to your src/App.js file.

Interacting with the Auth SDK

Feathery will dynamically load the appropriate JS SDK for your chosen auth integration. If you would like access to their SDK, you can listen to the onClientReady event or fetch it directly via useAuthClient().

Last updated

Was this helpful?