Skip to main content
A member signs in on OneSwap Wallet, sees your verified website and its list of fixed holder requirements, and accepts or declines the connection as a whole. Your backend receives a member ID scoped to this app. The same person has different IDs in different apps. The SDK opens OneSwap Wallet directly for sign-in and consent. If your site already uses PartyLayer, its OneSwap adapter can discover the wallet, identify the selected account and request message signatures. Start the SDK sign-in when a member wants to use your creator app, even if they have connected through PartyLayer. This lets them approve the holder checks you listed. OneSwap PartyLayer adapter

Connect a member

Set up the backend client from the installation guide. In your sign-in POST handler, generate a new authorization request. Save its one-time state and verifier in the visiting member’s server-side session before redirecting to url.
Here, sessions is your application’s session store. Use an unpredictable cookie with Secure, HttpOnly and SameSite=Lax. Require a same-origin request for the sign-in POST. Your server can redirect straight to url. A client-side button that receives this URL from your server can call the browser helper below.
In the registered callback handler, consume the pending request once. Build the callback from your configured HTTPS origin and the actual return path and query. The following example runs inside a Node.js HTTP handler.
Mount this handler only at the registered callback path. Make takePending atomic so two callbacks cannot reuse one request. After success, return the rotated session cookie and redirect to a clean application URL. Keep the verifier, codes and access token out of client code, logs and analytics. If the member declines, return them to your public site. Access tokens expire after ten minutes. Start sign-in again when necessary. To disconnect, call oneswap.auth.revoke(accessToken) and clear your local session.

Protect a route

Register a fixed minimum under My launches → dApps → Holder requirements. For example, set the holder requirement to one available token. Available holdings exclude locked amounts. Total holdings include them. Incoming offers count only after settlement. This function runs on your server. Call it at the point where you serve private content or perform the protected action. Hiding a button alone leaves the route accessible.
The app receives a decision per approved requirement. It cannot read the user’s balance or supply an arbitrary threshold. A fresh result lasts at most 30 seconds. Read again for each protected action and keep access closed on an exception or expired result. Use auth.me().capabilities to decide which features to show.

Change a membership tier

An app can register up to eight requirements and twenty experiences for its own token. In Holder requirements or Experiences, select Edit. Their IDs stay the same. Changing a requirement creates a new revision. When the server returns RULE_NOT_CONSENTED, invite the member to reconnect and review the updated requirement. Other requirements retain their existing consent. A 401 on a member token can require a new sign-in. If the SDK reports INVALID_CLIENT, check your server key and website verification. On a 429, wait for retryAfterMs when available and back off before retrying. Never turn an error into a successful holder check.