Security
We offer a possibility to add an authorization header to the custom API endpoints. You can insert a token using following option in TOPOL_OPTIONS. This authorization token will be added to all ongoing requests to your server.
Set initial token
Using standard Authorization
js
apiAuthorizationHeader: "Bearer token";
This will resolve in header: Authorization Bearer_token
Custom header name
If you want to name the header yourself you can use following option:
js
apiAuthorizationHeader: {
'Header-name': 'secret'
}
Refresh token
In case you need to refresh authorization token we provide a function to do so.
js
TopolPlugin.updateApiAuthorizationHeader(newToken);
newToken
can be a string or an object that provides header name and the value.