Skip to content

Latest commit

 

History

History
129 lines (83 loc) · 7.95 KB

Authentication.md

File metadata and controls

129 lines (83 loc) · 7.95 KB

Authentication

ASP.NET Core Identity is a membership system that adds login functionality to ASP.NET Core apps.

Instructions

Below you will find the instructions, step-by-step to configure the following external login provider in your development environment.

Facebook

  1. Log In to Facebook using your account
  2. Go to All Apps - Facebook for Developers
  3. In the upper right corner, select My Apps and then click on Create App
  4. Fill the fields Display Name and Contact Email then click Create App ID
  5. You will see in the Dashboard a list of Products that you can add, we're going to configure Facebook Login, so, click on the Set Up button for that product Step 4, Set Up Facebook Login
  6. On the menu on the left, under Facebook Login, click on Settings. Under the Client OAuth Settings, there is a field called Valid OAuth Redirect URIs, where you have to put the URL of the project, eg. https://localhost:5001/, and then click on the Save Changes button. Step 5, Configure Settings for Facebook Login
  7. On the menu on the left, under Settings, click on Basic, you will see the Facebook App ID and App Secret, necessary to configure the Authentication in the project, copy them, you will need it in next step. Step 6, copying the App ID and App Secret
  8. In the Web project go to the file appsettings.Development.json go to the Facebook object, under Authentication, paste the App ID, and App Secret copied in the previous step.
  9. Run the project and Log In using Facebook.

Microsoft

  1. Log In to Microsoft Azure Portal using your Microsoft account

  2. Go to App registrations

  3. In the upper left corner, select New registration, now we need to fill the basic information about the application:

    • Fill the Name field for the application name, eg.: Emplea.do.

    • For Supported account types choose Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox), this will allow to login anyone with a Microsoft account.

    • For Redirect URI we need to use: https://localhost:5001/signin-microsoft, in the Development Environment this is the local URL that the projects use, appending the 'signin-microsoft' that identifies the login provider, in this case, Microsoft.

    • Click the Register button.

      Step 2, Register Application in Microsoft

  4. In the left menu, select Certificates & secrets, under Client secrets:

    • Click the New client secret button.
    • Add a Description for the new client secrete, eg.: ClientSecret
    • Select when this secret Expires, eg.: In 1 year

    This will generate a new client secret, copy the value we will need it.

  5. In the left menu, go to the application Overview, there you will see the Application (client) ID, copy it, we will need it in the next step.

  6. Back in our Emplea.do Web project go to the file appsettings.Development.json to the Microsoft object under Authentication and paste the App ID and App Secret copied in the previous steps.

  1. Run the project and Log In using Microsoft.

LinkedIn

  1. Log In to LinkedIn using your account

  2. Go to Developers | Linkedin and click in the Create app button

  3. We need to fill the basic information about the application:

    • Set the App name, eg.: Emplea.do.

    • LinkedIn Page: select one company page that you have access to, or just create one with testing propose, you can delete it later, eg: TestEmpleado

    • Logo, choose the company logo

    • Accept the Legal agreement and click the Create app button

      Step 2, Register Application in LinkedIn

  4. Go to the Auth tab, in the OAuth 2.0 settings add https://localhost:5001/signin-github in the Redirect URLs. From the Application credentials section copy the Client ID and the Client Secret, we will need it in the next step.

  5. Go to he Products tab, Select the product Sign In with LinkedIn, in almost 2 minutes they will approve your application.

    Step 4, Allow SignIn From LinkedIn

  6. Back in our Emplea.do Web project go to the file appsettings.Development.json to the Linkedin object under Authentication and paste the ClientId and ClientSecret copied in the previous steps.

  7. Run the project and Log In using LinkedIn.

GitHub

  1. Log In to GitHub using your account

  2. Go to New OAuth Application

  3. We need to fill the basic information about the application:

    • Set the Application Name, eg.: Emplea.do.

    • Homepage URL: https://localhost:5001

    • For Authorization callback URL we need to use: https://localhost:5001/signin-github, in the Development Environment this is the local URL that the projects use, appending the 'signing-github' that identifies the login provider, in this case, GitHub.

    • Click the Register Application button.

      Step 2, Register Application in GitHub

  4. Copy the Client ID and Client Secret, we will need it in the next step.

  5. Back in our Emplea.do Web project go to the file appsettings.Development.json to the Github object under Authentication and paste the ClientId and ClientSecret copied in the previous steps.

  6. Run the project and Log In using GitHub.

Google

  1. Log In to Google using your account

  2. Go to Integrating Google Sign-In into your web app and click in the Configure a project button

  3. From the dropdown, select + Create a new project, we need to fill the basic information about the application:

    • Set the Project name and click next, eg.: Empleado.
    • Enter the Product Name and click next, eg.: Emplea.do
    • From the dropdown select Web server as your OAuth client and set https://localhost:44343/signin-google as Authorized redirect URIs and click Create
  4. Copy the Client ID and Client Secret, we will need it in the next step.

  5. Back in our Emplea.do Web project go to the file appsettings.Development.json to the Google object under Authentication and paste the ClientId and ClientSecret copied in the previous steps.

  6. Run the project and Log In using Google.

References