Skip to main content

Setting Up Your C# project

In this example we're going to use the v3 Amazon Web Services SDK (once the v4 SDK settles down we'll switch to using that) to authenticate ourselves with our Cognito credentials. We'll be using Visual Studio Code with no platform dependent tools - but if you're using Visual Studio 202X, the steps should be similar, if not a little easier.

So in VS Code, available to download here, install the C# Dev Kit extension and follow the instructions to ensure that the .Net SDK and C# tools are on your machine.

It's worth noting there are some very good .Net GraphQL libraries. In these examples we've decide to remain library neutral but you needn't. Check out this example:

GraphQL Dotnet Introduction

GraphQL GitHub

...and there are many more. Hopefully at some point Microsoft will issue a native version. But for now let's start a new C# project in VS Code. Open the Command Palette (View -> Command Palette) and type start typing "new project", you should soon see the .Net: New project option.

Command palette in VS Code

Choose this option and then select the Console application type.

Console application in create project

Install AWS Credential Provider

We need to include the Amazon Credential Provider in order to authenticate any call we make to the Legalesign secure platform. It's best to set up a dedicated user account for your development and production api calls. In the examples, you'll see that we've named this account apiuser@legalesign.com, it will have its own password and removes reliance on any particular person's account.

info

At any time you can verify the API user account by using it to log into the Console application at (https://console.legalesign.com). Always check that the account details you're developing with are correct - you will save yourself hours of heartache!

At the terminal in the root of our project type:

dotnet add package Amazon.Extensions.CognitoAuthentication --version 2.5.6

Or search for the Nuget package manager for (https://www.nuget.org/packages/Amazon.Extensions.CognitoAuthentication/)[CognitoAuthentication on Nuget]