nstbrowser-sdk-node
Version:
nst browser node sdk
26 lines (20 loc) • 757 B
JavaScript
/**
* Example demonstrating how to clear the cookies for a specific profile.
*/
import { NstBrowserV2 } from 'nstbrowser-sdk-node';
// Initialize the client with your API key
const apiKey = process.env.NSTBROWSER_API_KEY || 'your_api_key';
const client = new NstBrowserV2(apiKey);
// Define the profile ID for which you want to clear cookies
const profileId = 'your_profile_id';
async function clearProfileCookies() {
try {
const response = await client.locals().clearProfileCookies(profileId);
console.log(`Cookies cleared successfully for profile ${profileId}`);
console.log('Response:', response);
} catch (error) {
console.error('Failed to clear profile cookies:', error);
}
}
// Execute the example
clearProfileCookies();