Content-Security-Policy header, you need to allow the Cashback Hive host in two directives. If you don’t use a CSP, nothing here applies.
Required directives
The SDK doesn’t use
eval, inline scripts, inline styles, iframes, web workers or WebSockets, so no 'unsafe-inline', 'unsafe-eval', frame-src or worker-src entries are needed.
Optional directives
Things CSP doesn’t govern
These are worth knowing about when reviewing the integration, even though no directive is required:- Sign-in popup.
auth.signIn()openshttps://sdk.cashbackhive.com/v1/authin a new window withwindow.open. CSP doesn’t restrict popups. If popups are blocked, the SDK falls back to a full-page redirect, whichnavigate-towould govern in browsers that implement it (none do at the time of writing). - Tracked clicks.
openOffer()openshttps://shop.cashbackhive.com/click/…in a new tab. Same as above. postMessage. The sign-in window sends the token back withpostMessage. The SDK checks the message origin itself; CSP isn’t involved.localStorage. The member token is stored undercbh:<key>:token. Not CSP-governed.
Example: Next.js
A minimal policy innext.config.ts:
Next.js itself needs
'unsafe-inline' or a nonce for script-src in development and for some runtime scripts. See the Next.js CSP guide for a nonce-based setup. Adding a nonce to the SDK <Script> tag works normally.Testing a policy safely
Deploy withContent-Security-Policy-Report-Only first. Violations are reported to the console (and to a report-to endpoint if you set one) without blocking anything, so you can confirm the SDK works before enforcing.