Implement Authentication in Angular 2+ application using LoginRadius CLI in 5 mins

Hello Guys!!!, today we will be implemented the authentication in the Angular 2+ application within 5 mins using LoginRadius.

Configuring LoginRadius

To implement authentication in the angular app first let’s start with registering in the Loginradius and creating the application using LoginRadius CLI.

LoginRadius CLI Setup

Mac or Linux

  • Install the tap via:
    $ brew tap loginradius/tap
  • Then, you can install LR CLI via:
    $ brew install lr

Other Platforms

After installing the CLI, you can register into the LoginRadius via the below command.

$ lr register

This command will open the Loginradius in the browser to register yourself and create the app.

alt_text

Once you successfully register you will be able to see the below message on the browser, you can close the tab and come back to the CLI.

You are Successfully Authenticated, Kindly Close this browser window and go back to CLI.

Get Your Application API Credentials

Once you login/register using the CLI, You can now run the lr get config command to get your API credentials.

alt_text

Configuring Callback URLs

A callback URL is a URL in your application where LoginRadius redirects the user after they have authenticated. The callback URL for your app must be added to your Application Configuration. If this field is not set, users will be unable to log in to the application and get an error.

alt_text

To get the list of whitelisted domains, you can run lr get domain command from the cmd prompt. And to add a domain in the list using lr add domain command.

If you are following this tutorial, you should set the http://localhost as a whitelisted domain. Check the below image for how to add the domain using LoginRadius CLI.

alt_text

You can read more in detail about implementing authentication in Angular 2+ in this tutorial

Published by

marinaelvis

Marina has over 10 years of experience in the marketing industry with extensive Institutional and Healthcare project portfolios as well as experience managing large, complex multi-use projects.

Leave a Reply

Your email address will not be published. Required fields are marked *