Overview
CognitoPass gives your game player accounts backed by an Amazon Cognito user pool. Players sign up, confirm their e-mail, sign in, add an authenticator app, reset forgotten passwords and stay signed in between game sessions. When you also configure a Cognito identity pool, the signed-in player's ID token is registered with it automatically, so Get AWS Credentials returns temporary AWS keys scoped to that player without any extra wiring.
- 18 latent nodes covering the complete account life cycle, each with On Success / On Failure pins and a clear error.
- Sign In and Respond To Challenge have an On Challenge pin for MFA codes, new passwords and MFA setup.
- Remembered sessions (refresh token in the SaveGame slot
CognitoPassSession) and automatic token refresh.
- App clients with a client secret: the
SECRET_HASH is computed for every request.
- Authenticator-app (TOTP) MFA with an
otpauth:// URI ready for a QR code.
- CognitoPass Subsystem events (On Signed In, On Signed Out, On Session Refreshed) for UI and game code.
- All requests run on background worker threads; results arrive on the game thread. Tokens and passwords are never logged.
Requirements
| Requirement | Details |
| Unreal Engine | 4.27 and 5.8 |
| Modules | CognitoPass (Runtime), CognitoPassSdk (External: AWS SDK for C++ 1.11.916, prebuilt) |
| Dependencies | None (engine modules only; no other plugins are enabled) |
| Platforms | Win64, Linux and Android |
| AWS | An AWS account with a Cognito user pool (and optionally an identity pool). Cognito usage is billed by AWS. |
Installation
- Install CognitoPass from Fab into your engine, or copy the
CognitoPass folder into your project's Plugins folder.
- Open the project, enable CognitoPass in Edit > Plugins and restart the editor.
- Open Project Settings > Plugins > CognitoPass and enter the User Pool Id and App Client Id (see Setting up Cognito).
- C++ only: add
PublicDependencyModuleNames.Add("CognitoPass"); to your Build.cs.
Verifying the installCall Is Configured on Begin Play and print Problem when it returns false.
Setting up Cognito
1. Create the user pool
- In the AWS console open Amazon Cognito > User pools > Create user pool.
- Application type: Mobile app (or "Traditional web application"). Give the app client a name, for example
game-client.
- Sign-in identifiers: choose Username and/or Email. Required attributes: at least
email if you want e-mail confirmation and password reset.
- Create the pool. Copy the User pool ID (for example
eu-west-1_AbCdEf123) into User Pool Id. The region is taken from it.
2. Configure the app client
- Open the pool's App clients page and select the app client. Copy its Client ID into App Client Id.
- Edit the authentication flows and enable
ALLOW_USER_PASSWORD_AUTH and ALLOW_REFRESH_TOKEN_AUTH.
- Recommended: create the app client without a client secret. If it has one, copy it into App Client Secret (Advanced) — but a secret inside a game build can be extracted.
- Optional: set the token validity (ID/access token 60 minutes and refresh token 30 days are common) and the attribute read/write permissions used by Update User Attributes.
- Keep refresh token rotation turned off: Restore Session and Refresh Session use the
REFRESH_TOKEN_AUTH flow.
3. MFA (optional)
Under Sign-in > Multi-factor authentication choose Optional MFA or Require MFA and enable Authenticator apps (and SMS or e-mail if you configured them). With required MFA, a player without MFA gets the MFA_SETUP challenge at sign-in: handle it with Setup Authenticator App and Verify Authenticator App.
4. Identity pool for AWS credentials (optional)
- Open Amazon Cognito > Identity pools > Create identity pool. Enable Authenticated access (and Guest access if guests need AWS access).
- Identity source: Amazon Cognito user pool; choose your user pool and app client.
- Create (or choose) the authenticated IAM role and give it only the permissions your game needs. The example below lets each player read and write their own folder of an S3 bucket.
- Copy the Identity pool ID (for example
eu-west-1:01234567-89ab-cdef-0123-456789abcdef) into Identity Pool Id.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PlayerOwnFolder",
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
"Resource": "arn:aws:s3:::my-game-saves/${cognito-identity.amazonaws.com:sub}/*"
},
{
"Sid": "ListOwnFolder",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::my-game-saves",
"Condition": { "StringLike": { "s3:prefix": "${cognito-identity.amazonaws.com:sub}/*" } }
}
]
}
The role's trust policy (created by the console) must allow sts:AssumeRoleWithWebIdentity for cognito-identity.amazonaws.com with your identity pool id in cognito-identity.amazonaws.com:aud and "cognito-identity.amazonaws.com:amr": "authenticated".
Least privilegeEverything the role allows, every signed-in player can do with their keys. Never attach broad policies such as AdministratorAccess or s3:* on *.
Quick start
- On your login screen call Restore Session. On Success = the player is signed in already (skip the form).
- Otherwise call Sign In with the user name and password from the form.
- On Success: read
Session.Sub (permanent player id) and go to the main menu.
- On Challenge: show the right prompt for Challenge Name (see Challenges) and call Respond To Challenge.
- On Failure: show
Error.Message. UserNotConfirmedException means the player must confirm the sign-up code first.
- New players: Sign Up → Confirm Sign Up with the code from the e-mail → Sign In.
- Bind On Signed Out of the CognitoPass Subsystem (Get Game Instance Subsystem) to return to the login screen.
Account nodes
| Node | Type | Description |
| Sign Up | Latent | Username, Password, Email, Attributes (map) → User Confirmed, Code Delivery Destination (masked, e.g. a***@e***.com). Attribute names are Cognito's: name, preferred_username, phone_number, custom:team ... |
| Confirm Sign Up | Latent | Username, Code. Confirms the account. |
| Resend Confirmation Code | Latent | Username → Code Delivery Destination. |
| Get User Attributes | Latent | → Attributes map (sub, email, email_verified, custom attributes ...). |
| Update User Attributes | Latent | Attributes map → Code Delivery Destination when a changed e-mail / phone number needs verification. |
| Verify User Attribute | Latent | Attribute Name, Code. With an empty Code it sends a new code; call it again with the code to verify. |
| Delete Account | Latent | Deletes the signed-in player from the pool and signs out (fires On Signed Out). |
Sign-in & session
| Node | Type | Description |
| Sign In | Latent | Username (or e-mail alias), Password. Pins: On Success (Session), On Challenge (Challenge Name, Challenge Parameters), On Failure. The challenge session is kept inside the plugin. |
| Respond To Challenge | Latent | Challenge Name (empty = the pending one), Responses map. Same three pins as Sign In. |
| Restore Session | Latent | Signs in with the refresh token saved by Remember Session. Fails with NoSavedSession when there is none; a rejected token is deleted. |
| Refresh Session | Latent | Renews the ID and access tokens now. With Auto Refresh nodes do this for you about 5 minutes before expiry. |
| Sign Out | Latent | bGlobal = also invalidate the player's tokens on every device (GlobalSignOut). The local session and saved slot are always cleared. |
Challenges & MFA
Respond To Challenge takes the Cognito response keys. The key CODE is mapped to the right key for the challenge, so one text box works for every code challenge. USERNAME and SECRET_HASH are added for you.
| Challenge | Responses | Notes |
NEW_PASSWORD_REQUIRED | NEW_PASSWORD (or CODE) | Accounts created by an administrator. Required attributes that are missing go in as userAttributes.<name>. |
SMS_MFA | SMS_MFA_CODE (or CODE) | Challenge Parameters contain CODE_DELIVERY_DESTINATION. |
SOFTWARE_TOKEN_MFA | SOFTWARE_TOKEN_MFA_CODE (or CODE) | The 6-digit code of the authenticator app. |
EMAIL_OTP | EMAIL_OTP_CODE (or CODE) | E-mail MFA (needs a pool with e-mail MFA enabled). |
SELECT_MFA_TYPE | ANSWER = SMS_MFA / SOFTWARE_TOKEN_MFA / EMAIL_OTP | The player chooses; the next challenge is the chosen one. |
MFA_SETUP | — | Call Setup Authenticator App then Verify Authenticator App; verifying completes the sign-in. |
Authenticator app
| Node | Type | Description |
| Setup Authenticator App | Latent | → Secret Code and Otp Auth Uri (otpauth://totp/<Project>:<user>?secret=...&issuer=<Project>; the issuer is the project name). Render the URI as a QR code or show the secret for manual entry. Works signed in or during an MFA_SETUP challenge. |
| Verify Authenticator App | Latent | Code, Friendly Name. Verifies the app and sets it as the preferred MFA method. |
Passwords
| Node | Type | Description |
| Forgot Password | Latent | Username → Code Delivery Destination. Sends a reset code to the verified e-mail or phone. |
| Confirm Forgot Password | Latent | Username, Code, New Password. |
| Change Password | Latent | Old Password, New Password (signed in). |
AWS credentials
Get AWS Credentials returns Identity Id, Access Key Id, Secret Access Key, Session Token and Expiration. In Cognito Identity Pool mode the player is authenticated when signed in (the ID token is registered as the login cognito-idp.<region>.amazonaws.com/<user pool id>) and a guest otherwise (when the pool and Allow Guest Access permit it). Credentials are cached and renewed 5 minutes before they expire.
Using the credentials with the other Alpha XP cloud pluginsFeed the values into Set Static Credentials of the other Alpha XP cloud plugins (call it again before Expiration), or give those plugins the player's login directly: Set Login Token with Provider = Get User Pool Provider Name and Token = Session.IdToken, so they obtain their own identity-pool credentials.
The Static Keys and Default Credential Chain modes return the keys from the settings or the standard AWS chain (environment, ~/.aws profile, instance role) — for development, dedicated servers and tools.
Helper nodes
| Node | Type | Description |
| Is Signed In | Pure | True while a session exists. |
| Get Session | Pure | The current FCognitoPassSession (Valid = false when nobody is signed in). |
| Get Token Claims | Pure | Token → Claims map + raw JSON of a JWT payload (e.g. email, cognito:groups, exp). The signature is not checked: verify tokens on your server. |
| Get User Pool Provider Name | Pure | cognito-idp.<region>.amazonaws.com/<user pool id>, the identity-pool login key. |
| Set Region | Callable | Overrides the region at runtime (empty = the region of the User Pool Id). |
| Is Configured | Pure | False with a Problem text when the settings are incomplete or the region does not match the pool. |
| Cancel / Is Finished | Callable Pure | On every latent node's returned object: stop waiting for a request / check whether it finished. |
Total Blueprint nodes: 18 latent + 6 helpers + 2 on the node object = 26.
Events
The CognitoPass Subsystem (a Game Instance Subsystem — use Get Game Instance Subsystem) broadcasts what the nodes do, so UI can react in one place:
| Event | Type | Fires when |
| On Signed In (Session) | Event | Sign In, Respond To Challenge, Restore Session or Verify Authenticator App (MFA_SETUP) signed a player in. |
| On Signed Out | Event | Sign Out, Delete Account, or the user pool rejected the refresh token. |
| On Session Refreshed (Session) | Event | Refresh Session or an automatic refresh renewed the tokens. |
Types
| Type | Kind | Fields |
| FCognitoPassSession | Struct | Username, Sub, Id Token, Access Token, Expires At (UTC), Valid. The refresh token stays inside the plugin. |
| FCognitoPassAwsCredentials | Struct | Identity Id, Access Key Id, Secret Access Key, Session Token, Expiration (UTC; max value for keys that never expire). |
| FCognitoPassError | Struct | Code (e.g. NotAuthorizedException, CodeMismatchException, UsernameExistsException, NotSignedIn), Message, Http Status, Retryable. |
| ECognitoPassCredentialMode | Enum | Cognito Identity Pool, Static Keys, Default Credential Chain. |
| UCognitoPassSubsystem | Class | Game Instance Subsystem with the events above. |
Settings
Project Settings > Plugins > CognitoPass (saved to DefaultGame.ini).
| Setting | Default | Description |
| User Pool Id | — | For example us-east-1_AbCdEf123. |
| App Client Id | — | The app client with ALLOW_USER_PASSWORD_AUTH + ALLOW_REFRESH_TOKEN_AUTH. |
| App Client Secret | empty | Only for app clients with a secret (SECRET_HASH = Base64(HMAC-SHA256(secret, username + client id))). |
| Remember Session | on | Store the refresh token in the SaveGame slot CognitoPassSession for Restore Session. |
| Auto Refresh | on | Renew the tokens about 5 minutes before they expire when a node needs them. |
| Credential Mode | Cognito Identity Pool | Source of Get AWS Credentials. |
| Identity Pool Id | empty | Optional; enables Get AWS Credentials in identity-pool mode. |
| Allow Guest Access | on | Guest identities before sign-in (the pool must allow them too). |
| Access Key Id / Secret Access Key | empty | Static Keys mode (development and servers; refused in Shipping unless Allow Static Keys In Shipping). |
| Region | empty | Empty = the region in the User Pool Id. |
| Endpoint Override | empty | A local user-pool emulator, for example http://localhost:9229. |
| Request / Connect Timeout, Max Retries, Worker Threads, Verify SSL, Log SDK Warnings | 30000 / 5000 / 3 / 4 / on / on | Connection options. |
C++
#include "CognitoPassLibrary.h"
#include "CognitoPassSubsystem.h"
// Events
UCognitoPassSubsystem* Accounts = GetGameInstance()->GetSubsystem<UCognitoPassSubsystem>();
Accounts->OnSignedIn.AddDynamic(this, &AMyHUD::HandleSignedIn);
// Session and claims
if (UCognitoPassLibrary::IsSignedIn())
{
const FCognitoPassSession Session = UCognitoPassLibrary::GetSession();
TMap<FString, FString> Claims;
FString Json;
UCognitoPassLibrary::GetTokenClaims(Session.IdToken, Claims, Json);
}
// Latent nodes are UBlueprintAsyncActionBase classes, e.g.
UCognitoPassSignInAction* SignIn = UCognitoPassSignInAction::SignIn(this, Name, Password);
SignIn->OnSuccess.AddDynamic(this, &AMyHUD::HandleSession);
SignIn->OnFailure.AddDynamic(this, &AMyHUD::HandleSession);
SignIn->Activate();
Security notes
- Tokens, passwords and secrets are never written to the log.
- The remembered refresh token is stored in a local SaveGame file. Turn off Remember Session on shared machines, or offer a "keep me signed in" checkbox and call Sign Out when it is unticked.
- Get Token Claims does not verify signatures. Backends must verify Cognito JWTs against the pool's JWKS.
- Prefer app clients without a secret for game clients, and keep identity-pool roles minimal.
- Never ship long-term access keys in a game client: use the identity pool for players.
Troubleshooting
| Symptom | Cause and fix |
InvalidParameterException: USER_PASSWORD_AUTH flow not enabled | Enable ALLOW_USER_PASSWORD_AUTH on the app client. |
NotAuthorizedException: Unable to verify secret hash | The app client has a secret: enter it in App Client Secret (or use an app client without one). |
UserNotConfirmedException at sign-in | Call Confirm Sign Up (or Resend Confirmation Code). |
NotSignedIn | The node needs a signed-in player: Sign In or Restore Session first. |
Restore Session fails with NotAuthorizedException | The refresh token expired or was revoked (Global Sign Out, password reset). The saved slot is deleted; sign in again. |
Get AWS Credentials: NotConfigured | Set Identity Pool Id, or switch Credential Mode. |
Get AWS Credentials: NotAuthorizedException / invalid login token | The identity pool does not list this user pool and app client as an identity provider. |
Unavailable | The SDK library could not be loaded or the game is shutting down; see the Output Log (LogCognitoPass). |
Credits
© 2026 Alpha XP — alphaxp.net · Support: support@alphaxp.net.
Includes the AWS SDK for C++ 1.11.916 (Apache-2.0). Built for Unreal Engine 4.27 and 5.8.