Skip to content

React sample web application to integrate with Asgardeo for B2C usecases

License

Notifications You must be signed in to change notification settings

wso2/asgardeo-react-b2c-sample-app

Repository files navigation

asgardeo-react-b2c-sample-app

React sample web application to integrate with Asgardeo for B2C usecases

👀 Live Deployment

A live preview of this demo is available at

  1. Vercel: https://asgardeo-react-sample-app.vercel.app
  2. Netlify: https://kaleidoscopic-medovik-1bf3fc.netlify.app

Features/ Capabilities

  • Sign up to Asgardeo as a new user
  • Sign In and Sign Out of the application
  • Home page with the references and guides
  • The user roles Manager and User.
    • Manager can view the Profile and API call pages
    • User can view the Profile page
  • User Profile to view and update details.
  • API call page to send an API call.
  • User can set up the preferred option for second factor authentication

Configure Asgardeo to integrate with your application

Create the application

  1. Access Asgardeo at https://console.asgardeo.io/ and log in.

  2. Click Applications in the left navigation menu.

  3. Create a new application

  • Select Single Page Application

Applications

  1. Fill the details and click Create.

Create application

Add Application Roles

  1. Navigate to User Management > Groups from the side panel
  2. Create a Group and add users

Add group

  1. Create a Role in the application

Add role

  1. Navigate to User Management > Roles from the side panel and assign the group to the role

Assign group

Application role

  1. Allow the application_roles attribute in the application

Application role attribute

Add Second Factor Authentication (Optional)

  1. Navigate to the Sign in methods of the application

  2. Add the second step authentication

Application signin method

🚀 Getting Started

  1. Clone the repository.
git clone https://github.com/dasuni-30/asgardeo-react-sample-app.git
  1. Install the dependencies.
npm install
  1. Create a .env file based on the .env.example file.
cp .env.example .env
  1. Update the values in the .env file based on your requirements.
# The port number on which the client application will run
PORT=3000

# The base URL of the server's API that the client application will communicate with
# E.g., http://localhost:5000
REACT_APP_API_ENDPOINT=<add-server-api-url>

# The client ID for the Asgardeo Single Page Application (SPA) app
REACT_APP_CLIENT_ID=<add-asgardeo-spa-app-client-id-here>

# The base URL for the client application
# E.g., http://localhost:3000
REACT_APP_CLIENT_BASE_URL=<add-client-app-base-url-here>

# The base URL for the Asgardeo organization's API
# E.g., https://api.asgardeo.io/t/your-org
REACT_APP_ASGARDEO_BASE_URL=<add-asgardeo-org-base-url-here>

# The sign-up URL for the Asgardeo organization
REACT_APP_SIGN_UP_URL=<asgardeo-sign-up-url>

# The application name for the Asgardeo application
REACT_APP_APPLICATION_NAME=<application-name>

# The organization name for the Asgardeo
REACT_APP_ORG_NAME=<org-name>
  1. Start the development server.
npm start

This will start the app on http://localhost:3000.

About

React sample web application to integrate with Asgardeo for B2C usecases

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published