kreatix
v0.1.0
Published
Official SDK for Kreatix Account — "Sign in with Kreatix", OAuth2/PKCE, user files and app storage
Maintainers
Readme
kreatix
Official SDK for Kreatix Account — "Sign in with Kreatix", OAuth2 + PKCE, user files and app storage.
npm install kreatixQuick start (browser)
import Kreatix from 'kreatix'
// open the Kreatix sign-in popup
const { code } = await Kreatix.signInPopup({
client_id: 'kx_app_...',
redirect_uri: 'https://yourapp.com/callback',
scope: 'profile:read files:read',
})
// exchange it server-side (never ship your api key to the browser)
const tokens = await Kreatix.exchangeCode({
code,
client_id: 'kx_app_...',
client_secret: 'kx_live_...', // server only!
redirect_uri: 'https://yourapp.com/callback',
})
const user = await Kreatix.userinfo(tokens.access_token)
// → { id, handle, name, avatar_url, ... }PKCE (no client secret — mobile, SPA, serverless)
const { verifier, challenge, method } = await Kreatix.pkce()
const { code } = await Kreatix.signInPopup({
client_id, redirect_uri, code_challenge: challenge, code_challenge_method: method,
})
const tokens = await Kreatix.exchangeCode({ code, client_id, redirect_uri, code_verifier: verifier })Tokens
// rotate a refresh token
const fresh = await Kreatix.refreshToken({ refresh_token, client_id })
// sign out a token
await Kreatix.revoke(tokens.access_token)User files
await Kreatix.files.upload(token, 'shot.png', fileBlob)
const files = await Kreatix.files.list(token)
await Kreatix.files.remove(token, file.id)App storage
await Kreatix.storage.put(token, 'save-1', { level: 12, hp: 80 })
const { value } = await Kreatix.storage.get(token, 'save-1')Deploy your app site ({slug}.kreatix.me)
Any file works — a single index.html, a .zip, or a .tar.gz:
curl -X PUT -H "x-api-key: $KX_KEY" --data-binary @dist.tar.gz \
https://id.kreatix.dev/api/apps/{app_id}/siteSingle file? Add -H "x-filename: index.html".
idp: https://id.kreatix.dev · docs: https://id.kreatix.dev/docs
