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.
View the demo app hosted on Microsoft Azure.
- 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": "http://localhost:5000/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 http://localhost:5000/.
- Login to Azure Portal and create a new App Service
- 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 - Add a new deployment to point to a cloned version of this repository and sync.