Skip to main content

Creating a Session

The Session class​

A Session is an interface that contains all the tasks currently used to interact with the Union Avatars API. It handles authentication, operations and logging.

At it's core, it's an interface (ISession) that you can implement to customize if behaviour. But for most of the use cases, you can just use our default implementation called Server Session

Session Context​

A session needs to store some data, such as the authentication, the organization ID,... This is all managed and contained by the SessionContext.

The ServerSession already takes care of creating one on construction and updating its values.

Creating a Session​

csharp
async void CreateSessionWithAPIKey()
{
// Create a new session
ServerSession session = new ServerSession(organization: "YOUR ORG ID");
// You can authenticate it using an API Key if you need it
session.SessionContext.AuthenticateWithApiKey("YOUR API KEY");
// ...
}
csharp
async void CreateSessionWithAPIKey()
{
// Create a new session
ServerSession session = new ServerSession(organization: "YOUR ORG ID");
// You can authenticate it using an API Key if you need it
session.SessionContext.AuthenticateWithApiKey("YOUR API KEY");
// ...
}