Session Token
Retrieves the session token generated after successful license validation.
Signature
std::string GetSessionToken() const;Parameters
None - This function takes no parameters.
Returns
Type: std::string
Non-empty string
Valid session token
Empty string
No active session (not authenticated)
Description
The session token is a JWT (JSON Web Token) that represents an authenticated session. It is:
Generated by the server after successful license validation
Stored internally by the library
Used for subsequent authenticated requests
Time-limited (expires after period of inactivity)
You must call ValidateKey() successfully before a session token is available.
Basic Example
Use Cases
Session Token Format
The session token is a JWT with the following structure:
******************
Session Lifecycle
Checking Session Status
Security Considerations
Do not expose session tokens publicly
Session tokens should be treated as sensitive credentials.
Do not store tokens in plain text files
Do not log tokens in production
Clear tokens on application exit
Tokens are used internally by the library
All communication is encrypted
Tokens are validated server-side
Tokens are signed with HMAC
Server validates signature
Expired tokens are rejected
Error Handling
Best Practices
Session Management
Check token exists before assuming authenticated
Re-validate if token is empty
Handle token expiration gracefully
Clear tokens on logout
Related Functions
ValidateKey - Validate license and create session
GetKeyInfo - Get license details
Last updated