Developer

Creating a Login Section

Table of Contents:

Introduction

When you need authentication process that only allow your registered users to access your app, you need to add a Login section. By this guide, we will provide you practice to add a Login section to your website. Several authentication third-party can be used to create this Login section, such as Auth0. 

Using Auth0

  1. After creating a new Auth0 account, you will be navigated to the Dashboard for the first time. You will find options that will guide you to setup the Auth0 to your website. Choose to follow the guide. 

  2. Follow the starting guide steps until you are ready to create an application.

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-25_13-58-42_published.png

     

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-25_14-01-42_published.png

     

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-25_14-07-09_published.png

     

  3. Auth0 will provide you with the starting sample code that will be used in the next step, better to download the sample code. 

  4. Next after finishing the starting guide, you need to create an application. Click the Create Application in Getting Started page.
     

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-26_11-57-41_published.png

     

  5. Fill the Name field and choose Single Page Application for the application type, then click Create
     

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-26_12-03-09_published.png

     

  6. You will be navigated to the Application page, there will be another Quick Start that will guide to setup Auth0 in your website. You can follow it and use the previous downloaded sample code as starter. 

  7. In the code sample, several lines need to be change. More important in the auth_config.json, you need to change the variable value there based on your application. You can find the value inside the Application page > Settings tab.

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-26_12-00-01_published.png

     

  8. Don't forget to register your URLs in the Allowed Callback URLs and Allowed Logout URLs to validate your redirect destination after login or logout. The option to insert the URLs is in Application page > Settings tab > below the Application Properties section.
     

    https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-26_12-00-20_published.png

     

  9. Finally you can run your sample code to try the authentication process locally by following the instruction in the guide to use npm run dev command in terminal.
     
https://media.nimvio.com/Project_c1457a00-729a-456c-841b-5c10710e8a18/Media/Resources/Guide/Developer%20-%20Create%20a%20Login%20Section/2023-07-26_13-53-37_published.webp



What's Next?

Congratulations! You have finished guide on creating a login section with Nimvio and authentication third-party service. Keep exploring others below: