SDK Parameters
Syntax
The JS SDK is initialized using this syntax:
clientID
The Socratease CLIENT_ID is one half of a key pair that identifies your Socratease Property (Definitions). The client ID can be made public.
jsonPayload
The payload is a set of parameters Payload that you want to initialize the library with. This will contain information such as the user details, what component you want the library to load and so on. You need to pass the payload as a JSON
hmacPayload
Because the Socratease SDK is a client-side library, your end user can see the code and can manipulate it. For example, they could open up the code in their browser's "Inspect" window, and change the username to someone else's. To protect against this, we need to ensure that the payload the Socratease library receives is what you, as the website owner, want to send us. HMAC authentication is how we achieve this.
You can read about it in our page on HMAC authentication, but the basic idea is that you compute the hash of the JSON payload using a SECRET_KEYthat you receive when you create your account. You will store this secret key in your backend and will use it to compute the HMAC of the payload. When the Socratease backend receives any request, it will compute the HMAC of the payload, and check that it matches what was provided to the SDK. Because only your backend knows the SECRET_KEY, if your end-user manipulates the payload, they will not be able to generate the correct HMAC and their request will return a 403 error.
options
Use this to customize the behaviour of Socratease. For example, you may want to inject the Socratease DOM into a certain div. Or, you may want to use your own navbar instead of the Socratease navbar. Learn more here: Options