Skip to content

blackbaud/sky-api-tutorial-auth-code-c-sharp

Repository files navigation

.NET Core C# Authorization Code Flow Tutorial - SKY API

A demonstration of the authorization code flow within SKY API, implemented using .NET Core.

This code sample is a very basic example of how to interact with the Blackbaud OAuth 2.0 Service. You are free to choose the client library and method that best suit your needs when creating production-level applications.

Run locally:

  • Download and install .NET Core SDK
  • Open Terminal/Command Prompt and type:
$  git clone https://github.com/blackbaud/sky-api-auth-tutorial-c-sharp.git
$  cd sky-api-auth-tutorial-c-sharp
  • Duplicate appsettings.json-sample as appsettings.Development.json and fill in the missing values (all required).
{
    "AppSettings": {
        "AuthClientId": "<Your developer app ID>",
        "AuthClientSecret": "<Your developer app secret>",
        "AuthRedirectUri": "https://localhost:5001/auth/callback",
        "AuthSubscriptionKey": "<Your developer subscription key>"
    }
}
  • Open Terminal/Command Prompt and type:
dotnet restore
  • On a Mac, type:
export ASPNETCORE_ENVIRONMENT=Development && dotnet run
  • On a PC, type:
set ASPNETCORE_ENVIRONMENT=Development && dotnet run
  • (PowerShell users may type:)
$Env:ASPNETCORE_ENVIRONMENT = "Development"

Visit https://localhost:5001/.

Deploy to Azure App Services:

  1. Login to Azure Portal and create a new App Service
  2. Under the app's Application Settings, add the following settings:
    `AppSettings:AuthClientId` Your registered application's Application ID
    `AppSettings:AuthClientSecret` Your registered application's Application Secret
    `AppSettings:AuthRedirectUri` The respective URI listed under your registered application's Redirect URIs
    `AppSettings:AuthSubscriptionKey` Your Blackbaud Developer Subscription Key
  3. Add a new deployment to point to a cloned version of this repository and sync.

Releases

No releases published

Packages

No packages published