Cladior · Reference
SDK Reference
Load with one script tag. Everything else is automatic.
The methods below are available if you need them; most integrations only use getUserInfo().
Loading
HTML
<script
src="https://www.cladior.com/sdk/v2.js"
data-cladior-site="your-app-id"
></script>Place before any inline scripts that use cladiorPass. No defer or async.
Methods
| Method | Returns | What it does |
|---|---|---|
| cladiorPass.getUserInfo() | Promise<{avatar_url, theme}> | Returns the user's profile. Fields are null if the user hasn't granted that scope. Call inside a pass:connected listener. |
| cladiorPass.getToken() | string | null | The current session token, or null. Only needed for custom domain setups where you want to pass the token to your own backend manually. |
| cladiorPass.login() | Promise<void> | Opens the connect popup. The SDK calls this automatically; you only need it for a manual "Connect" button. |
| cladiorPass.logout() | void | Clears the session. |
| cladiorPass.isAuthenticated | boolean | True if a valid session is stored. |
Event
| Event | Fires when |
|---|---|
window: pass:connected | After every successful connect, including session restore on page load. Use it to call getUserInfo(). |
Scopes
Set scopes per app in the dashboard, not in code. Users see and accept them on the connect screen.
| Scope | What it unlocks in getUserInfo() |
|---|---|
| avatar | avatar_url: the user's profile picture URL |
| theme | theme: "light" or "dark" |