deleteApiKey #
Available since 7.1.0
Available since Kuzzle 2.1.0
Deletes an API key for the currently logged user.
deleteApiKey(id, [options]);
Property | Type | Description |
---|---|---|
id | string | API key unique ID |
options | object | Additional options |
options #
Additional query options
Property | Type (default) | Description |
---|---|---|
refresh | boolean ( false ) | If set to wait_for , Kuzzle will not respond until the API key is indexed |
queuable | boolean ( true ) | If true , queues the request during downtime, until connected to Kuzzle again |
timeout | number ( -1 ) | Time (in ms) during which a request will still be waited to be resolved. Set it -1 if you want to wait indefinitely |
triggerEvents | boolean ( false ) | If set to true , will trigger events even if using Embeded SDK. You should always ensure that your events/pipes does not create an infinite loop. Available since Kuzzle 2.31.0 |
Resolves #
Resolves if the API key is successfully deleted.
Usage #
try {
await kuzzle.auth.login('local', {
username: 'jane.doe',
password: 'password',
});
const apiKey = await kuzzle.auth.createApiKey('Sigfox API key', {
refresh: 'wait_for'
});
await kuzzle.auth.deleteApiKey(apiKey._id);
console.log('API key successfully deleted');
} catch (e) {
console.error(e);
}
Edit this page on Github(opens new window)