Skip to main content
MindTouch Success Center

Use a browser API token with an integration

Instructions and examples to use your browser API token in order to gain web browser access to the MindTouch API.

How to use your browser API token

The token key is included in an API request by setting it on the X-Deki-Token HTTP header.

Examples

Fetch API

const key = 'dacaffe7ce69dfd1071531e925f667905a1c981fb40d06c676880e84352cb3aa';
fetch('https://example.com/@api/deki/pages/home/info', {
    headers: {
        'X-Deki-Token': key
    }
}).then((response) => {
    
    // ...
});

jQuery

const key = 'dacaffe7ce69dfd1071531e925f667905a1c981fb40d06c676880e84352cb3aa';
$.ajax({
    url: 'https://example.com/@api/deki/pages/home/info',
    method: 'GET',
    headers: {
        'X-Deki-Token': key
    }
}).done((data) => {

    // ...
});

Upon receipt, MindTouch checks the Origin HTTP Header sent by the browser against the hostname patterns whitelisted when the API token was generated. If there is a match, the cross origin API request is allowed. If the origin hostname does not match any of the API token's whitelisted hostname patterns, the API request is denied and an error message is returned.

  • Was this article helpful?