Split Token

The concept of split token is used throughout the Trustly API. The client receives half a token and Trustly's API gets the other half. For this approach to exchange, the Trustly half is not cached, which increases the security.

When token service is issued for a client, it splits the token into two parts:

  • the signature of the token
  • the head and body of the token

From there, the token service sends back the signature half to the client while the token service hashes the signature part and sends the hash with the second half (the head and body) to the API Gateway. The gateway then caches the token using the hashed signature as the key for the cache. The value is cached as long as the expiration time of the token.

When the client sends a request, the API Gateway takes the signature part sent by the client, hashes it and looks it up in its cache. Then it can glue back the token - the head, body and signature, and forwards it to any API service handling the request. Thus, the API gets a whole token, ready to be deserialized and used as needed.

Did this page help you?