From 9b0625219b76bbcff062793ce13dcfa37ae7ecc9 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Fri, 26 May 2023 14:14:37 +0000 Subject: [PATCH] GITBOOK-331: Adding javascript code example for /deleteAuthToken --- .../provider/authentication-endpoints.md | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/developers/provider/authentication-endpoints.md b/developers/provider/authentication-endpoints.md index 1a431cfd..87c7745b 100644 --- a/developers/provider/authentication-endpoints.md +++ b/developers/provider/authentication-endpoints.md @@ -66,15 +66,42 @@ token: token to be expired Returns: Success message if token is successfully deleted. If the token is not found or already expired, returns an error message. -Example: +#### Javascript Example: ``` -DELETE /api/services/deleteAuthToken?address=&&nonce=&&token=&signature= +const axios = require('axios'); + +// Define the address, token, and signature +const address = ''; // Replace with your address +const token = ''; // Replace with your token +const signature = ''; // Replace with your signature + +// Define the URL for the deleteAuthToken endpoint +const deleteAuthTokenURL = 'http:///api/services/deleteAuthToken'; // Replace with your provider's URL + +// Make the DELETE request +axios.delete(deleteAuthTokenURL, { + data: { + address: address, + token: token + }, + headers: { + 'Content-Type': 'application/json', + 'signature': signature + } +}) +.then(response => { + console.log(response.data); +}) +.catch(error => { + console.log('Error:', error); +}); + ``` -Inside the angular brackets, the user should provide the valid values for the request. +Replace ``, ``, ``, and `` with actual values. This script sends a DELETE request to the `deleteAuthToken` endpoint and logs the response. Please ensure that `axios` is installed in your environment (`npm install axios`). -Response: +#### Example Response: ``` {"success": "Token has been deactivated."}