Plugin Documentation

TokenSmith
JSON Web Tokens for Blueprint and C++

Create, sign and verify JSON Web Tokens and read their claims from Blueprints or C++. TokenSmith is an engine subsystem, so the same nodes work in the editor, in packaged games and on dedicated servers.

v1.0
UE 4.27 & 5.8
Win64 (verified), Linux, Linux ARM64
Category Networking
Alpha XP

Overview

TokenSmith implements JSON Web Tokens (JWT, RFC 7519) for Unreal Engine 4.27 and 5.8. Use it to issue session tokens on a dedicated server, to check tokens your backend hands to clients, or to read the claims of a token your login service returned.

  • Generate signed tokens with your own payload and header claims, an optional issued-at claim, not-before and expiry times.
  • Registered claims: type (typ), content type (cty), key id (kid), subject, audience and token id.
  • Verify the signature plus issuer, subject, audience, token id and any custom claim, with a clock-skew leeway.
  • Read every payload claim of a token into a String-to-String map.
  • HMAC (HS256, HS384, HS512) with a shared secret and RSA (RS256, RS384, RS512) with PEM keys.
  • 17 Blueprint nodes on the UTokenSmithSubsystem engine subsystem, plus a C++ API.
  • Uses the engine’s own OpenSSL; no network access, no external services.

Requirements

RequirementDetails
Unreal Engine4.27 and 5.8 (verified clean on both)
ModulesTokenSmith (Runtime), TokenSmithVerifier (Runtime), TokenSmithGenerator (Runtime)
DependenciesNone (engine modules only; signing uses the engine’s OpenSSL module).
LanguageBlueprints and C++
PlatformsWin64, Linux and Linux ARM64 (LinuxAArch64 on UE 4.27, LinuxArm64 on UE 5.8), as listed in the plugin descriptor. Win64 is the platform built and verified by Alpha XP; the Linux targets are supported by the code, not verified by Alpha XP.

Installation

  1. Copy the TokenSmith folder into your project’s Plugins folder (or install it to the engine from Fab).
  2. Open the project; C++ projects build the plugin modules on the first start.
  3. Enable TokenSmith in Edit > Plugins and restart the editor.
  4. C++ only: add "TokenSmith", "TokenSmithGenerator" and "TokenSmithVerifier" to your module’s dependencies and set bEnableExceptions = true; in that module’s Build.cs — the public headers include the JWT library, which reports errors with C++ exceptions.
Verifying the installIn any Blueprint graph, search for Generate Signed JWT: the TokenSmith nodes are listed under TokenSmith > Generator and TokenSmith > Verifier. At startup the Output Log shows TokenSmithGenerator Startup and TokenSmithVerifier Startup.

Quick start

Blueprint

  1. Place the TokenSmith Subsystem getter (search for TokenSmith Subsystem; it is an engine subsystem and works in any Blueprint).
  2. Call Initialize JWT Generator with your secret and HS256.
  3. Call Generate Signed JWT: tick IATClaim, fill Claims (for example role → admin), leave Not Before Sec at 0 and Expire After Sec at 900. The return value is the token.
  4. Call Initialize JWT Verifier with the same secret and HS256, then Verify JWT with the token: it returns true.
  5. Call Get Claims to read the payload as a map.

C++

// MyModule.Build.cs:
// PrivateDependencyModuleNames.AddRange(new string[] { "TokenSmith", "TokenSmithGenerator", "TokenSmithVerifier" });
// bEnableExceptions = true;
#include "TokenSmithSubsystem.h"
#include "Engine/Engine.h"

void IssueAndCheckToken()
{
    UTokenSmithSubsystem* Tokens = GEngine->GetEngineSubsystem<UTokenSmithSubsystem>();

    Tokens->InitGenerator(TEXT("my-shared-secret"), ETokenSmithGeneratorAlgorithm::HS256);
    Tokens->SetSubject(TEXT("player-42"));

    TMap<FString, FString> Claims;
    Claims.Add(TEXT("role"), TEXT("admin"));
    const FString Token = Tokens->GenerateJwtToken(true, Claims, TMap<FString, FString>(), 0, 900);

    Tokens->InitVerifier(TEXT("my-shared-secret"), ETokenSmithVerifierAlgorithm::HS256);
    Tokens->WithSubject(TEXT("player-42"));
    const bool bValid = Tokens->VerifyJWT(Token);

    const TMap<FString, FString> Payload = Tokens->GetClaims(Token);
    UE_LOG(LogTemp, Display, TEXT("Valid: %d, role: %s"), bValid ? 1 : 0, *Payload.FindRef(TEXT("role")));
}

Generator nodes

Category TokenSmith | Generator, on UTokenSmithSubsystem. Settings made with these nodes stay on the shared generator and apply to every token generated afterwards.

NodeTypeDescription
Initialize JWT GeneratorCallableKey, Algorithm. Sets the signing key and algorithm: the shared secret for HS256/384/512, the PEM private key for RS256/384/512.
Set TypeCallableSets the typ header claim.
Set Content TypeCallableSets the cty header claim.
Set Key IDCallableSets the kid header claim.
Set SubjectCallableSets the sub payload claim.
Set AudienceCallableSets the aud payload claim.
Set IDCallableSets the jti payload claim.
Generate Signed JWTCallableIATClaim, Claims, Header Claims, Not Before Sec (default 0), Expire After Sec (default 900) → String. Adds iat (now) when IATClaim is set, nbf = now + Not Before Sec and exp = now + Expire After Sec, plus your string claims, and signs the token. Returns an empty string on failure.

Verifier nodes

Category TokenSmith | Verifier, on UTokenSmithSubsystem. Requirements added with the With nodes stay on the shared verifier for the rest of the session.

NodeTypeDescription
Initialize JWT VerifierCallableKey, Algorithm. Allows the algorithm with the given key: the shared secret for HS256/384/512, the PEM public key for RS256/384/512.
With IssuerCallableRequires the iss claim to equal the value.
With SubjectCallableRequires the sub claim to equal the value.
With AudienceCallableRequires the aud claim to contain the value.
With LeewayCallableLeeway (seconds) tolerated when checking exp, nbf and iat against the local clock.
With IDCallableRequires the jti claim to equal the value.
With Custom ClaimCallableName, Value. Requires a string claim with that name and value.
Verify JWTCallableInput → Boolean. True when the token decodes, its algorithm is allowed, the signature matches, it is within its time window and every requirement holds. Failures are logged with the reason.
Get ClaimsCallableJWTToken → String-to-String map. All payload claims; strings without quotes, numbers and other JSON values as their JSON text. Does not verify the token — call Verify JWT first.

Algorithms

NodeTypeDescription
ETokenSmithGeneratorAlgorithmEnumInput of Initialize JWT Generator: HS256, HS384, HS512, RS256, RS384, RS512.
ETokenSmithVerifierAlgorithmEnumInput of Initialize JWT Verifier: the same six values.

Keys are passed as text: for HMAC the secret itself, for RSA the complete PEM block including the -----BEGIN ...----- and -----END ...----- lines. Keys, claim names and claim values are handled as UTF-8.

C++ API

NodeTypeDescription
UTokenSmithSubsystemClassEngine subsystem with all the nodes above as C++ functions: InitGenerator, SetType, SetContentType, SetKeyID, SetSubject, SetAudience, SetID, GenerateJwtToken, InitVerifier, WithIssuer, WithSubject, WithAudience, SetLeeway, WithID, WithCustomClaim, VerifyJWT, GetClaims. Get it with GEngine->GetEngineSubsystem<UTokenSmithSubsystem>().
GetTokenSmithCallableTSharedPtr<FTokenSmithModule> GetTokenSmith() on the subsystem.
FTokenSmithModuleClassGetGenerator() and GetVerifier() return the generator and verifier the subsystem uses.
FTokenSmithGeneratorModuleClassInitGenerator, SetType, SetContentType, SetKeyID, SetSubject, SetAudience, SetID, GenerateJwtToken(bool IATClaim, int32 NotBeforeSec, int32 ExpireAfterSec, TMap<FString, FString> Claims, TMap<FString, FString> HeaderClaims).
FTokenSmithVerifierModuleClassInitVerifier, WithIssuer, WithSubject, WithAudience, SetLeeway, WithID, WithCustomClaim, VerifyJWT, GetClaims.
ExceptionsEvery module that includes a TokenSmith header must set bEnableExceptions = true; in its Build.cs. Without it MSVC reports warning C4530 and the build may fail. Blueprint-only projects are not affected.

Troubleshooting

SymptomCause and fix
Verify JWT returns falseThe Output Log (LogTokenSmithVerifier) shows the reason. Usual causes: wrong key or algorithm, the token expired (exp) or is not valid yet (nbf), or an issuer / subject / audience / id / custom claim requirement does not match. Use With Leeway when server and client clocks differ.
Generate Signed JWT returns an empty string, log Error generating JWT.For RS256/384/512 the generator key must be a valid PEM private key (the verifier takes the public key). Call Initialize JWT Generator before generating.
A token stops verifying after other code used the subsystemThe generator and verifier are shared engine-wide and keep every setting and requirement for the session. Set the requirements you need in one place, early, rather than per call.
C++ build error or warning C4530 in your moduleAdd bEnableExceptions = true; to the Build.cs of every module that includes TokenSmith headers.
Get Claims returns an empty mapThe input is not a well-formed JWT (three dot-separated Base64URL parts), or it is empty.
Numbers come back as text such as 1767225600Get Claims returns every claim as a string; convert numeric claims (for example exp) with the usual string conversion nodes.
Plugin modules are missing on Mac, Android or iOSThe plugin descriptor enables the modules for Win64, Linux and Linux ARM64 only.

Credits

© 2026 Alpha XP — alphaxp.net · Support: support@alphaxp.net. Built and verified for Unreal Engine 4.27 and 5.8.