Logo

OAuth Overview

OAuth (Open Authorization) allows users to sign in to your application using their existing accounts from providers like Google, Facebook, and Microsoft.

How It Works

  1. User clicks "Sign in with [Provider]" on your login page
  2. User is redirected to the provider's login page
  3. User enters their credentials and grants permission
  4. Provider redirects back to your application with an authorization code
  5. Your application exchanges the code for user information
  6. User is logged in to your application

Benefits of OAuth

Supported Providers

Provider Configuration Setting Setup Guide
Google EnableGoogleAuth Google OAuth Setup
Facebook EnableFacebookAuth Facebook OAuth Setup
Microsoft EnableMicrosoftAuth Microsoft OAuth Setup

Configuration Structure

OAuth settings are stored in appsettings.json:

{
  "Authentication": {
    "EnableGoogleAuth": false,
    "Google": {
      "ClientId": "",
      "ClientSecret": ""
    },
    "EnableFacebookAuth": false,
    "Facebook": {
      "AppId": "",
      "AppSecret": ""
    },
    "EnableMicrosoftAuth": false,
    "Microsoft": {
      "ClientId": "",
      "ClientSecret": ""
    }
  }
}
Security Note:
Never commit client secrets to source control. Use User Secrets during development and environment variables or Azure Key Vault in production.