Skip to content

Simple Unity authentication implementation using AWS Cognito

License

Notifications You must be signed in to change notification settings

klumhru/cognity

Repository files navigation

Cognity - AWS Cognito for Unity

Cognity is a middleware to authenticate users with Cognito in the popular Unity game engine.

AWS provides a basic set of client libraries for Unity, but officially only supports those libraries in Mobile builds of Unity. Thus this library, which is independent of deployment platform.

Features

The library contains basic code implementation of interacting with basic principles of user management.

  • Registration
  • Email confirmation
  • Sign in and token refresh
  • Recover password
  • Basic profile settings
  • Local storage of authentication between sessions

There is also a very basic UI demonstrating all the functions.

Building

The code is written in clear C#. The demo application should open and run without issues on any recent Unity version that supports .Net Standard 2.0. It uses IObserver/IObservable to execute non-blocking web requests.

Dependencies

The library uses Newtonsoft for configuration only for convenience and as example.

Deploying

There is a backend IaC stack in terraform contained in the Backend/ folder. This can be used to deploy a complete Cognito User Pool and Identity Pool. Use terraform out -json > ../Assets/cognity.json command to generate the configuration file for Unity.