Wind Wind / Docs
Dashboard

Wind Connect — OAuth

Let users link their portable Wind wallet to your app via a standard OAuth code exchange.

Step 1 — Register a redirect URI

In your app's General tab, register the callback URL.

text
https://yourapp.com/callback

Step 2 — Redirect to Wind Connect

typescript
const url = new URL('https://user.usewind.app/connect')
url.searchParams.set('app_id', YOUR_APP_ID)
url.searchParams.set('redirect_uri', 'https://yourapp.com/callback')
url.searchParams.set('state', crypto.randomUUID())
window.location.href = url.toString()

Step 3 — Exchange the code (server-side)

typescript
const response = await fetch('https://wind-production-3225.up.railway.app/user/connect/exchange', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ code: req.query.code, redirectUri: 'https://yourapp.com/callback' }),
})
const { windUserId } = await response.json()
Codes expire after 10 minutes and are single-use. Always verify the state parameter to prevent CSRF.

Wind Connect — Popup Mode

Opens Wind Connect in a popup and communicates the result back via postMessage.

Step 1 — Open the popup

typescript
const url = new URL('https://user.usewind.app/connect')
url.searchParams.set('mode', 'popup')
url.searchParams.set('allowed_origin', 'https://yourapp.com')
url.searchParams.set('app_id', 'your-app-id')
url.searchParams.set('external_user_id', currentUser.id)
const popup = window.open(url.toString(), 'wind-connect', 'width=480,height=640')

Step 2 — Listen for the result

typescript
window.addEventListener('message', (event) => {
  if (event.origin !== 'https://user.usewind.app') return
  if (event.data.type === 'wind_connected') {
    const { wind_user_id, wind_email } = event.data
  }
})