bkend-auth
Skill70 starsChanged 9 months agoApache-2.0View on GitHub
bkend.ai authentication guide. Signup, login, JWT tokens, sessions, role-based access control, and password management with bkend.ai BaaS. Triggers: bkend auth, bkend login, bkend signup, JWT, session, RBAC, password, bkend 인증, 로그인, 회원가입, bkend認証, ログイン, 新規登録, bkend认证, 登录, 注册, autenticacion bkend, authentification bkend, bkend-Auth Do NOT use for: data operations (use $bkend-data), file storage (use $bkend-storage).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- ww-w-ai/bkit-claude-codetheir own version, first seen Aug 14, 2026
- ww-w-ai/bkit-geminitheir own version, first seen Apr 9, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- ww-w-ai/bkit-claude-code★ 600same name
- ww-w-ai/bkit-gemini★ 66same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bkend-cookbookSkill
- bkend-dataSkill
- bkend-quickstartSkill
- bkend-storageSkill
- bkit-rulesSkill
- bkit-templatesSkill
- code-reviewSkill
- codex-learningSkill
- desktop-appSkill
- development-pipelineSkill
- dynamicSkill
- enterpriseSkill
- mobile-appSkill
- pdcaSkill
- phase-1-schemaSkill
- phase-2-conventionSkill
- phase-3-mockupSkill
- phase-4-apiSkill
- phase-5-design-systemSkill
- phase-6-ui-integrationSkill
- phase-7-seo-securitySkill
- phase-8-reviewSkill
- phase-9-deploymentSkill
- plan-plusSkill
- starterSkill
- zero-script-qaSkill
The file
Files
bkend.ai Authentication
Implement user authentication with bkend.ai BaaS.
Actions
| Action | Description | Example |
setup | Set up auth | $bkend-auth setup |
flow | Auth flow diagram | $bkend-auth flow |
rbac | Role-based access | $bkend-auth rbac |
Authentication Flow
1. User submits email + password
2. POST /auth/email/signup (new user) or /auth/email/signin (existing)
3. Server returns { user, access_token, refresh_token }
4. Store access_token in memory/localStorage
5. Store refresh_token in httpOnly cookie (secure)
6. Include access_token in Authorization header for API calls
7. When access_token expires -> use refresh_token to get new one
8. On logout -> invalidate tokensSignup
async function handleSignup(email: string, password: string, name: string) {
const { user, access_token, refresh_token } = await bkend.auth.signup({
email, password, name,
});
localStorage.setItem('bkend_access_token', access_token);
return user;
}Login
async function handleLogin(email: string, password: string) {
const { user, access_token, refresh_token } = await bkend.auth.signin({
email, password,
});
localStorage.setItem('bkend_access_token', access_token);
return user;
}Get Current User
async function getCurrentUser() {
return bkend.auth.me(); // Uses token from localStorage
}Logout
function handleLogout() {
bkend.auth.signout().catch(() => {});
localStorage.removeItem('bkend_access_token');
localStorage.removeItem('bkend_refresh_token');
window.location.href = '/login';
}Token Refresh
async function refreshToken() {
const refreshToken = localStorage.getItem('bkend_refresh_token');
if (!refreshToken) throw new Error('No refresh token');
const { access_token } = await bkend.auth.refresh(refreshToken);
localStorage.setItem('bkend_access_token', access_token);
return access_token;
}Protected Route Component
'use client';
import { useAuth } from '@/hooks/useAuth';
import { redirect } from 'next/navigation';
export function ProtectedRoute({ children }: { children: React.ReactNode }) {
const { user, isLoading } = useAuth();
if (isLoading) return <div>Loading...</div>;
if (!user) redirect('/login');
return <>{children}</>;
}Role-Based Access Control
// Check user role
function RequireRole({ role, children }: { role: string; children: React.ReactNode }) {
const { user } = useAuth();
if (user?.role !== role) return <div>Access denied</div>;
return <>{children}</>;
}
// Usage
<RequireRole role="admin">
<AdminDashboard />
</RequireRole>Login Form Example
'use client';
import { useState } from 'react';
import { useAuth } from '@/hooks/useAuth';
import { useRouter } from 'next/navigation';
export function LoginForm() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState('');
const { login, isLoading } = useAuth();
const router = useRouter();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setError('');
try {
await login(email, password);
router.push('/dashboard');
} catch (err) {
setError(err instanceof Error ? err.message : 'Login failed');
}
};
return (
<form onSubmit={handleSubmit} className="space-y-4">
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)}
placeholder="Email" required className="w-full border rounded px-3 py-2" />
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)}
placeholder="Password" required className="w-full border rounded px-3 py-2" />
{error && <p className="text-red-500 text-sm">{error}</p>}
<button type="submit" disabled={isLoading}
className="w-full bg-blue-500 text-white py-2 rounded hover:bg-blue-600 disabled:opacity-50">
{isLoading ? 'Signing in...' : 'Sign In'}
</button>
</form>
);
}Reference
See references/bkend-patterns.md for the full auth store implementation and advanced patterns.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

