Skip to content

v1.3.0-beta - Token auth & Environment Improvements

Pre-release
Pre-release

Choose a tag to compare

@IamGodseye IamGodseye released this 03 Mar 13:03
· 111 commits to main since this release
6bf8a0c

Added

  • TokenUtils Class: New static utility class for JWT token operations and validation
    • Token format validation
    • Payload decoding for JWT tokens
    • Expiration verification to prevent use of expired tokens
    • Claim extraction functionality for retrieving specific token data
  • Enhanced Environment Support: Improved handling of development and production environments
    • Standardized URL constants for both environments
    • WebView now dynamically uses correct store URL based on environment
  • Security Enhancements: Fixed authentication vulnerabilities
    • Token validation before processing in authentication flow
    • Improved error handling for invalid tokens
    • Better credential injection in WebView with verification

Usage

Opening Store with Token

// Open store without authentication
PlaySuperUnitySDK.Instance.OpenStore();

// Open store with a token (will be validated automatically)
PlaySuperUnitySDK.Instance.OpenStore("your-jwt-token");

// The token will be validated for format and expiration
// An InvalidOperationException 

Token Validation

try {
    // Validate a JWT token
    bool isValid = TokenUtils.ValidateToken(myToken);
} 
catch (Exception ex) {
    Debug.LogError($"Token validation failed: {ex.Message}");
}

Environment Selection

// Production environment
PlaySuperUnitySDK.Initialize("your-api-key");

// Development environment
PlaySuperUnitySDK.Initialize("your-api-key", _isDev: true);

Compatibility

  • Fully backwards compatible with existing implementations
  • No breaking changes from v1.2.2
  • Recommended update for users wanting to use their own authentication on store