Frontend Integration
This section provides comprehensive guides for integrating Wink Identity Web into your frontend applications.
Before You Begin
Use this page as a pre-flight checklist before following a stack-specific integration guide.
1) Request credentials
If you do not have your Wink credentials yet (clientId and clientSecret), request them here:
Request Integration Credentials
You can also request access through your onboarding channel or Wink representative.
2) Choose your stack guide
- React: React JS Starter Kit (Vite + TypeScript)
- Next.js: Next.js Starter Kit
- Vanilla JS: Vanilla JS Starter Kit (plain HTML + JS, or bundled)
Common Requirements (All Stacks)
Every integration follows the same security model: session-first, server-side secrets, and backend-mediated API calls.
Backend requirements
Your backend must provide internal endpoints that:
- Create a Wink session and return a
sessionId(for example,GET /session?returnUrl=...&cancelUrl=...). - Retrieve or verify the user profile after authentication (for example,
GET /user) using a client token.
Never expose
clientSecretin frontend code.
Never call Wink Session/Verify APIs directly from the browser.
For backend implementation details, see the Backend Integration guide.
Configuration requirements
- Client-side configuration (browser-safe):
clientId,realm, and Wink base/auth URLs- Example names:
VITE_WINK_CLIENT_ID,VITE_WINK_REALM,VITE_WINK_BASE_URL,VITE_WINK_AUTH_URL
- Server-side configuration (never exposed):
clientSecretand any credentials used to call Wink APIs
- HTTPS in production is required
Quick Risk Checklist (Read Before Coding)
These are the most common causes of failed integrations.
Whitelist and CORS
- Web Origins and Valid Redirect URIs are different settings. Both must be configured in Wink.
- Web Origins must not include a trailing slash.
- Redirect URI matching is exact by default. For dynamic routes, request
/*or use a short callback URL.
CSP
- Add Wink hosts (for example
https://stageauth.winkapis.com) to your app CSP:connect-srcframe-srcscript-src
A generic "Load failed" after a successful scan is often CSP-related, not CORS.
Required winkInit options (every call)
winkInit options (every call)checkLoginIframe: falsesilentCheckSsoRedirectUri: undefinedsilentCheckSsoFallback: false- Explicit
redirectUrithat matches a whitelisted URL
Flow-specific behavior
- OAuth
codemay return in the URL hash (response_mode=fragment), not query params. - Clear
localStorage.login_session_stateon mount to avoid redirect loops. - Pass
sessionIdonly on the login-start leg, never on callback return. - Call
winkLogout()only whenclient.authenticatedis true.
Two rules to memorize
- Every
winkInit(...)should include the three stability flags plus explicitredirectUri. - Never read
window.locationduring React render; read it insideuseEffect.
Additional Resources
Updated 9 days ago
