Official JavaScript SDK for Flowsta Authentication - Zero-knowledge, OAuth-based Single Sign-On for web applications.
New to Flowsta? Create a developer account to get your Client ID.
| Package | Version | Description |
|---|---|---|
| @flowsta/auth β | 2.0.0 |
Core OAuth SDK with React bindings |
| @flowsta/login-button | 0.1.0 |
Pre-built button components |
| @flowsta/holochain | 1.0.0 |
Holochain integration |
- Get your Client ID: Sign up at dev.flowsta.com
- Add redirect URI: Configure
https://yoursite.com/auth/callbackin your app settings
Install the SDK for modern web apps:
npm install @flowsta/authFor quick integration with UI components:
npm install @flowsta/login-buttonSupports: React, Vue, Qwik, Vanilla JS
Use vanilla JavaScript without npm:
OAuth 2.0 authentication with PKCE - no client secrets needed.
Features:
- β OAuth 2.0 + PKCE (Proof Key for Code Exchange)
- β Zero-knowledge architecture - user data stays encrypted
- β
React bindings included (
@flowsta/auth/react) - β TypeScript-first with full type safety
- β Zero dependencies - lightweight (< 10kb)
- β Works in any JavaScript environment
Pre-built "Sign in with Flowsta" button components.
Features:
- β Multiple frameworks: React, Vue, Qwik, Vanilla JS
- β 6 button variants (dark/light/neutral Γ pill/rectangle)
- β Automatic PKCE generation and state management
- β Customizable styling and behavior
- β Inline SVG assets - works with any bundler
Sign Holochain actions using your Flowsta identity.
Features:
- β Sign zome calls with Flowsta agent key
- β Seamless Holochain integration
- β TypeScript support
Perfect for static HTML sites or simple projects:
<!DOCTYPE html>
<html>
<head>
<title>Login with Flowsta</title>
</head>
<body>
<a href="#" id="login-btn">
<img src="https://docs.flowsta.com/buttons/svg/flowsta_signin_web_dark_pill.svg"
alt="Sign in with Flowsta"
width="175" height="40">
</a>
<script type="module">
import { FlowstaAuth } from 'https://unpkg.com/@flowsta/auth';
const auth = new FlowstaAuth({
clientId: 'your-client-id',
redirectUri: window.location.origin + '/callback.html'
});
document.getElementById('login-btn').addEventListener('click', (e) => {
e.preventDefault();
auth.login();
});
</script>
</body>
</html>View Complete Vanilla JS Guide β
Using the built-in React bindings:
import { FlowstaAuthProvider, useFlowstaAuth } from '@flowsta/auth/react';
import { FlowstaLoginButton } from '@flowsta/login-button/react';
function App() {
return (
<FlowstaAuthProvider
clientId="your-client-id"
redirectUri="https://yoursite.com/auth/callback"
>
<Dashboard />
</FlowstaAuthProvider>
);
}
function Dashboard() {
const { isAuthenticated, user, login, logout } = useFlowstaAuth();
if (!isAuthenticated) {
return <FlowstaLoginButton onClick={login} variant="dark-pill" />;
}
return (
<div>
<h1>Welcome, {user?.displayName}!</h1>
<p>@{user?.username}</p>
<button onClick={logout}>Logout</button>
</div>
);
}<script setup>
import { FlowstaAuth } from '@flowsta/auth';
import { FlowstaLoginButtonVue } from '@flowsta/login-button/vue';
import { ref, onMounted } from 'vue';
const auth = new FlowstaAuth({
clientId: 'your-client-id',
redirectUri: 'https://yoursite.com/callback'
});
const user = ref(null);
const isAuthenticated = ref(false);
onMounted(() => {
isAuthenticated.value = auth.isAuthenticated();
user.value = auth.getUser();
});
const login = () => auth.login();
const logout = () => {
auth.logout();
isAuthenticated.value = false;
user.value = null;
};
</script>
<template>
<div v-if="!isAuthenticated">
<FlowstaLoginButtonVue
client-id="your-client-id"
redirect-uri="https://yoursite.com/callback"
variant="dark-pill"
/>
</div>
<div v-else>
<h1>Welcome, {{ user?.displayName }}!</h1>
<button @click="logout">Logout</button>
</div>
</template>For maximum control and flexibility:
import { FlowstaAuth } from '@flowsta/auth';
const auth = new FlowstaAuth({
clientId: 'your-client-id',
redirectUri: 'https://yoursite.com/auth/callback',
scopes: ['openid', 'email', 'display_name', 'username']
});
// Redirect to Flowsta login
auth.login();
// On your callback page
try {
const user = await auth.handleCallback();
console.log('Authenticated:', user.displayName, user.username);
// Redirect to dashboard
window.location.href = '/dashboard';
} catch (error) {
console.error('Authentication failed:', error);
window.location.href = '/login?error=auth_failed';
}The @flowsta/login-button package includes 6 official button styles:
Download all button assets β
After authentication, you'll receive a FlowstaUser object with the requested scopes:
interface FlowstaUser {
sub: string; // Unique user ID (always available)
display_name?: string; // Display name (if 'display_name' scope)
username?: string; // Username (if 'username' scope)
email?: string; // Email (if 'email' scope)
email_verified?: boolean; // Email verification status
profile_picture?: string; // Profile picture URL (if 'profile_picture' scope)
agent_pub_key?: string; // Holochain agent key (if 'public_key' scope)
did?: string; // Decentralized ID (if 'did' scope)
}Available Scopes:
openid- Required, provides user IDemail- User's email addressdisplay_name- User's display nameusername- User's @usernameprofile_picture- Profile picture URLpublic_key- Holochain agent public keydid- W3C Decentralized Identifier
Flowsta provides zero-knowledge authentication powered by Holochain:
- π Zero-Knowledge: Your data is encrypted end-to-end - only you can decrypt it
- π Single Sign-On: One login works across all Flowsta-enabled applications
- π Decentralized Identity: Built on Holochain's DHT for censorship resistance
- β‘ Easy Integration: Standard OAuth 2.0 with PKCE security
- π‘οΈ Privacy-First: No tracking, no data mining, no selling your information
- User logs in via
login.flowsta.com - Data is encrypted with user's password (zero-knowledge)
- Stored on Holochain DHT (decentralized, censorship-resistant)
- Your app receives an access token via OAuth
- Fetch user data from the Auth API (decrypted on-demand)
- Getting Started Guide - Complete setup tutorial
- OAuth Quickstart - NPM integration guide
- Vanilla JS Guide - No build tools required
- Button Downloads - Download button assets
- API Reference - Complete API docs
- Security Guide - Best practices
- @flowsta/auth - Core SDK documentation
- @flowsta/login-button - Button components
- @flowsta/holochain - Holochain integration
- Developer Portal - Create apps, manage settings
- Community Discord - Get help, share ideas
- GitHub Issues - Report bugs
The following packages are from SDK 1.0 and should not be used for new projects:
| Package | Status | Replacement |
|---|---|---|
@flowsta/auth-sdk |
Use @flowsta/auth (v2.0) |
|
@flowsta/auth-client |
Use @flowsta/auth (v2.0) |
|
@flowsta/auth-react |
Use @flowsta/auth/react |
|
@flowsta/auth-widgets |
Not needed (OAuth-only in v2.0) |
Why the migration? SDK 2.0 uses OAuth-only authentication for better security and simpler integration. No more email/password handling in your app!
# Clone the repository
git clone https://github.com/WeAreFlowsta/flowsta-sdk.git
cd flowsta-sdk
# Install dependencies
npm install
# Build all packages
npm run buildnpm run build # Build all packages
npm run dev # Watch mode for development
npm run test # Run tests (coming soon)
npm run lint # Lint code (coming soon)sdk-monorepo/
βββ packages/
β βββ auth/ # Core OAuth SDK (v2.0)
β βββ login-button/ # Pre-built button components
β βββ holochain/ # Holochain signing integration
β βββ core/ # [Deprecated] SDK 1.0 core
β βββ client/ # [Deprecated] SDK 1.0 client
β βββ react/ # [Deprecated] SDK 1.0 React
β βββ widgets/ # [Deprecated] SDK 1.0 widgets
βββ README.md
We welcome contributions! Please see our Contributing Guide for details.
MIT Β© Flowsta
- Website: flowsta.com
- Documentation: docs.flowsta.com
- Developer Portal: dev.flowsta.com
- GitHub: github.com/WeAreFlowsta/flowsta-sdk
- npm: @flowsta
Questions? Join our Discord community or check out the documentation.