This project is no longer maintained on GitHub, but you may obtain the latest maintained version on Unreal Marketplace.
EasyJwt is a JSON web tokens engine sub-system for Unreal Engine 4/5, that provides a c and bluprint interface to Generate, Sign, Verify and manage claims of JWT.
- Windows x86_64
- Hololens 2 (Windows ARM64)
- Linux x86_64
- Linux ARM64
Link the plugin modules to your project through <YourModule>.build.cs
:
bEnableExceptions = true;//we are using exceptions
PrivateDependencyModuleNames.AddRange( new string[]
{
"EasyJwt",
"JwtCpp",
"JwtVerifier",
"JwtGenerator"
});
Initialize the Generator
#include "EasyJwtSubsystem.h"
TSharedPtr<FEasyJwtModule> EasyJwt = GEngine->GetEngineSubsystem<UEasyJwtSubsystem>()->GetEasyJwt();
EasyJwt->GetGenerator()->InitGenerator(`<SIGNING_KEY>`, EGeneratorAlgorithm::HS256);
Generate Signed Token Basic Example:
#include "EasyJwtSubsystem.h"
TSharedPtr<FEasyJwtModule> EasyJwt = GEngine->GetEngineSubsystem<UEasyJwtSubsystem>()->GetEasyJwt();
TMap<FString, FString> Claims =
{
{"Claim1","34235"},
{"Claim2","dfgds"}
};
TMap<FString, FString> HeaderClaims =
{
{"HeaderClaim1","345343"},
{"HeaderClaim2","jhgfdrtt"}
};
/*
Valid since generating it and for 900sec with the givem claims.
*/
FString JwtToken = EasyJwt->GetGenerator()->GenerateJwtToken(true, 0, 900, Claims, HeaderClaims);
Initialize the Generator
Generate Signed Toker
Blueprint API
Initialize the Verifier
#include "EasyJwtSubsystem.h"
TSharedPtr<FEasyJwtModule> EasyJwt = GEngine->GetEngineSubsystem<UEasyJwtSubsystem>()->GetEasyJwt();
EasyJwt->GetVerifier()->InitVerifier(`<SIGNING_KEY>`, EVerifierAlgorithm::HS256);
Verify a Token
#include "EasyJwtSubsystem.h"
TSharedPtr<FEasyJwtModule> EasyJwt = GEngine->GetEngineSubsystem<UEasyJwtSubsystem>()->GetEasyJwt();
bool bValid = EasyJwt->GetVerifier()->VerifyJWT(`<TOKEN_TO_VERIFY>`);
Get Claims From JWT
#include "EasyJwtSubsystem.h"
TSharedPtr<FEasyJwtModule> EasyJwt = GEngine->GetEngineSubsystem<UEasyJwtSubsystem>()->GetEasyJwt();
TMap<FString, FString> Claims = EasyJwt->GetVerifier()->GetClaims(`<JWT>`);
Initialize the Verifier
Verify a Token
Extract Claims From a JWT
Blueprint API
- HS256
- HS348
- HS512
- RS256
- RS384
- RS512
- ES256 Unreal Marketplace version only
- ES384 Unreal Marketplace version only
- ES512 Unreal Marketplace version only
- PS256 Unreal Marketplace version only
- PS384 Unreal Marketplace version only
- PS512 Unreal Marketplace version only
More to come soon!!
Give us a ⭐️!