Custom Session Endpoint
Handling loading/storing your end-user content
By default, Mirin will store and load your end-user documents on our servers throughout a session.
If you prefer to handle this yourself, you can easily do so by specifying a custom endpoint in your embed configuration.
Set up
First, login to your account and specify a custom POST
endpoint in your Embed’s settings.
Then create the endpoint on your server:
Authentication
When we load the <Embed />
component on your frontend, recall that it will need to perform an authentication on your server to generate a valid token:
Then on your server, you will typically call Mirin’s client.authenticate
:
The client.authorize()
method accepts a context
argument where you can pass additional information that you may need to throughout a session. This context
argument will be passed whenever your endpoint is called.
For example:
Loading a Document
When Mirin tries to load a document to display to the user on the editor, the GetDocument
payload will be sent your endpoint:
Storing a Document
When Mirin tries to store a document that the user is editing, the UpdateDocumentContent
payload will be sent your endpoint: