Skip to content

Latest commit

 

History

History
115 lines (87 loc) · 3.35 KB

setup-authentication-providers.md

File metadata and controls

115 lines (87 loc) · 3.35 KB

Setup authentication providers

Prerequisites

Install Secret Manager tool to be able to store credentials. Otherwise, create a new file ./src/GovITHub.Auth.Identity/appsettings.development.json and add a section named Authentication.

Setup Facebook authentication

Register Facebook app

  • Navigate to https://developers.facebook.com/apps and add new Facebook app
  • Open the Settings tab and click on Add new platform
  • Select Website as the platform
  • In Site URL box put https://localhost:44301/

Add Facebook app credentials

With Secret Manager tool

  • Open shell
  • Navigate to ./src/GovITHub.Auth.Identity/
  • Execute the following commands:
dotnet user-secrets set Authentication:Facebook:AppId <app-Id>
dotnet user-secrets set Authentication:Facebook:AppSecret <app-secret>

In appsettings.development.json file

Add Facebook section to Authentication section; the file should look like this:

{
  "Authentication": {
    "Facebook": {
      "AppId": "<app-id>",
      "AppSecret": "<app-secret>"
    }
  }
}

Setup Google authentication

Register Google app

Add Google app credentials

With Secret Manager tool

  • Open shell
  • Navigate to ./src/GovITHub.Auth.Identity/
  • Execute the following commands:
dotnet user-secrets set Authentication:Google:GoogleClientId <client-id>
dotnet user-secrets set Authentication:Google:GoogleClientSecret <client-secret>

In appsettings.development.json file

Add Google section to Authentication section; the file should look like this:

{
  "Authentication": {
    "Google": {
      "GoogleClientId": "<client-id>",
      "GoogleClientSecret": "<client-secret>"
    }
  }
}

Setup LinkedIn authentication

Register LinkedIn application

  • Log in to https://developer.linkedin.com/
  • From the navigation bar select My Apps and then click on Create Application
  • Fill in the required info and in Website URL box type http://localhost:5000
  • Press Submit and you will be redirected to the new application

LinkedIn application setup

  • In the Authentication tab
    • In Default application permissions section check r_basicprofile and r_emailaddress
    • In OAuth 2.0 section add http://localhost:5000/Account/ExternalLoginCallback to the Authorized Redirect URLs

Add LinkedIn app credentials

With Secret Manager tool

  • Open shell
  • Navigate to ./src/GovITHub.Auth.Identity/
  • Execute the following commands:
dotnet user-secrets set Authentication:LinkedIn:ClientId <client-id>
dotnet user-secrets set Authentication:LinkedIn:ClientSecret <client-secret>

In appsettings.development.json file

Add LinkedIn section to Authentication section; the file should look like this:

{
  "Authentication": {
    "LinkedIn": {
      "ClientId": "<client-id>",
      "ClientSecret": "<client-secret>"
    }
  }
}