Skip to main content

Phase 2: Session Management

Session management handles user authentication and maintains user state across API calls using JWT tokens.

Overview

AspectDetails
Token TypeJWT (JSON Web Token)
AlgorithmHS256
Expiry1 hour (3600 seconds)
RefreshVia refresh token

Create Session (Login)

Endpoint: POST /api/v2.1/customer/individual/{customerId}/users/{userId}/sessionsPath Parameters:
  • customerId: Customer UUID from registration
  • userId: User UUID from registration
Request Body:
{
  "username": "[email protected]",
  "password": "SecurePass123!@#",
  "tenantKey": "fh_api_finsei_ltd_7f957f77",
  "tenantSecret": "your-tenant-secret-key"
}

JWT Token Structure

Decoded Token

{
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "user-660e8400-e29b-41d4-a716-446655440011",
    "customerId": "cust-550e8400-e29b-41d4-a716-446655440010",
    "tenantId": "97e7ff29-15f3-49ef-9681-3bbfcce4f6cd",
    "roles": ["USER"],
    "email": "[email protected]",
    "sessionId": "sess-770e8400-e29b-41d4-a716-446655440020",
    "iat": 1705148400,
    "exp": 1705152000,
    "iss": "muse-proxy-bff",
    "aud": "finhub-services"
  }
}

Token Claims

ClaimDescription
subUser ID (subject)
customerIdCustomer ID
tenantIdTenant UUID
rolesUser roles array
sessionIdSession identifier
iatIssued at timestamp
expExpiration timestamp
issIssuer
audAudience

Using the JWT Token

Include the token in all subsequent API calls:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Token Expiry: Tokens expire after 1 hour. Use the refresh token to obtain a new access token before expiry.

Delete Session (Logout)

Endpoint: DELETE /api/v2.1/customer/individual/{customerId}/users/{userId}/sessions/{sessionId}Headers:
Authorization: Bearer {jwt-token}
X-Forwarded-For: 192.168.1.100
User-Agent: Mozilla/5.0...

Session Security

Lockout Policy

MetricValue
Max Failed Attempts5
Lockout Duration30 minutes
Lockout ResetAfter successful login

Session Metadata Captured

  • Client IP address
  • User agent string
  • Platform information
  • Creation timestamp
  • Last activity timestamp

Next Step

After creating a session, proceed to Phase 3: Verification to complete KYC verification.

Phase 3: Verification

Submit identity documents for KYC verification