Skip to content

descope-sample-apps/b2b-react-sample-app

Repository files navigation

b2b-react-sample-app

Getting Started

Set up

In order to launch this app:

1. Clone the repo

git clone git@github.com:descope-sample-apps/b2b-react-sample-app.git

2. Set up Descope environment variables in .env file

REACT_APP_DESCOPE_PROJECT_ID="YOUR PROJECT ID" // Required for Descope authentication
REACT_APP_DESCOPE_SIGN_IN_FLOW_ID="sign-up-or-in" // Optional, if you would like to use a flow other than sign-up-or-in
REACT_APP_DESCOPE_MANAGEMENT_KEY="YOUR MANAGEMENT KEY" // Optional, if you would like to run E2E tests
DESCOPE_BASE_URL="http://localhost:8000" // Optional, if you would like to use a different base URL

You can get your project-id here. You can get this flow-id from the Flows page here.

3. Install dependencies

You can use npm or yarn, but we recommend using yarn. If it isn't already installed on your machine, the instructions on how to do so can be found here. After yarn is installed, run this command:

yarn install

4. Start the app

Run this command to start the app:

yarn start

5. Open the app

Browse to http://localhost:3000

User invitation with Magic Link

This app contains a user invitation route that uses a magic link. To use it, go to your project configuration and do the following

  • Set the "User Invitation Redirect URL" to a URL with the path of auth/invitation (e.g. http://localhost:3000/auth/invitation)
  • Check the Add a "Magic Link token to the invitation link" checkbox, so that the token is sent in the invitation email

Testing

To run Cypress E2E tests:

yarn run cypress open

Other Configuration

Management Widgets & SSO Setup

To test Management Widgets or SSO Setup functionality, you'll need to have a user configured with a tenant and the Tenant Admin role assigned.

Learn More

To learn more please see the Descope Documentation and API reference page.

Contact Us

If you need help you can contact us