To authenticate your application with Stripo Plugin Editor, you should call the endpoint, shown in the sample code below, with your PluginId and Secret Key

POST: /api/v1/auth
Host: https:
Content-Type: application/json
Accept: application/json
Body: {pluginId:YOUR_PLUGIN_ID,secretKey:YOUR_SECRET_KEY,role:PLUGIN_EDITOR_USER_ROLE}
Response: {token:YOUR_AUTH_TOKEN}

which are available on the Plugin details page

Plugin configuration contains a parameter called getAuthToken. Plugin calls function (this parameter value) each time a token is expired in order to get a new one. You have to implement this method on your side.

The full authentication schema looks like this:

Example of the getAuthToken implementation:

getAuthToken: function(callback) {
   $.ajax({
  type: 'GET',
  url: '/backend/plugin/token',
  contentType: 'application/json; charset=utf-8',
  dataType: 'json',
  success: data => callback(data.token),
  error: error => callback(null)
   });
}

You can see the description of all steps of the schema in our API documentation.

IMPORTANT:
Do NOT call Stripo Backend directly from your UI. It is insecure and your "Secret Key" can be stolen. Keep your "Secret Key" on your back-end and do not tell anyone it.

Please find the example of the real code in our repository.

Feel free to contact us if any questions arise.

Did this answer your question?