Skip to main content

Theca-User-Token

Why it is needed

The Theca-Client-Token will uniquely identify which site user you are sending information from. Best would be if this is always the same ID, e.g. could it be an email, unique hash etc.

A long string that uniquely identifies each user. This can then be used to learn more about user behavior and improve hits over time.

How to implement it

This sent in the header for every request to theca. This should contain as far as possible a unique identifier for each customer. It should not be regenerated on call or new session if possible.

An example in kotlin

  1. Set the Theca-User-Token
  2. Call the api

Set the URL and call from backend. Please note that the Theca-Client-Token is needed in the header too. Refer to Theca-Client-Token page for more information.

fun setHeaders(session: HttpSession): HttpEntity<String> {​
// Create HttpHeaders​
val headers = HttpHeaders()​

headers.set("Theca-Client-Token", "demo")​
   //Theca-Client-Token is set here​
headers.set("Theca-User-Token", session.getAttribute("sessionHash").toString())​
// You can add more headers if needed​

// Create an HttpEntity with headers (no body in this case)​
val entity = HttpEntity<String>(headers)​

return entity
}

Where to read more about it

docs.theca.com/api/overview