Installation
CDN (Recommended)
Add the script tag directly to your HTML file:@latest
to always get the latest version, or specify a version with @deflectbot/[email protected]
.
NPM/Yarn
If you prefer using a package manager:npm
yarn
Quick Start
1. Configure the SDK
Configure Deflect with your Action ID (get this from your dashboard):2. Get a token for protected requests
When you need to make a request to a protected endpoint (login, register, payment, etc.):3. Form Helper (Optional)
If you’re using HTML forms, you can use the helper function:injectToken()
function will automatically fetch a token and inject it as a hidden input named deflect_token
into your form.