Guide
Integrate Nexbic authentication into your application. Supports email/password, OAuth 2.0, SSO, and social login providers.
Implementation
Create a new user account with email and password. Nexbic handles hashing, session creation, and email verification.
const { user, session } = await nexbic.auth.signUp({
email: "user@example.com",
password: "securepassword",
name: "Jane Doe"
});
// Session is automatically created
console.log(session.id); // "nxb_ses_..."curl -X POST https://api.nexbic.dev/v1/auth/signup \
-H "Content-Type: application/json" \
-H "X-API-Key: nxb_sk_..." \
-d '{
"email": "user@example.com",
"password": "securepassword",
"name": "Jane Doe"
}'{
"user": {
"id": "usr_1",
"email": "user@example.com",
"name": "Jane Doe",
"email_verified": false
},
"session": {
"id": "nxb_ses_...",
"expires_at": "2026-06-19T00:00:00Z"
}
}Implementation
Authenticate existing users with email and password. Returns a session token for subsequent requests.
const { user, session } = await nexbic.auth.signIn({
email: "user@example.com",
password: "securepassword"
});
// Store the session token
localStorage.setItem("nexbic_session", session.id);curl -X POST https://api.nexbic.dev/v1/auth/login \
-H "Content-Type: application/json" \
-H "X-API-Key: nxb_sk_..." \
-d '{
"email": "user@example.com",
"password": "securepassword"
}'Implementation
Manage user sessions with refresh tokens, validation, and revocation.
// Validate the current session
const { valid, user } = await nexbic.auth.validateSession(sessionId);
if (!valid) {
// Redirect to login
}
// Refresh an expiring session
const { session } = await nexbic.auth.refreshSession(refreshToken);
// Sign out (revoke session)
await nexbic.auth.signOut(sessionId);Implementation
Support Google, GitHub, Apple, and any OAuth 2.0 / OIDC provider with a single unified API.
// Initiate OAuth flow
const { url } = await nexbic.auth.oauth.init({
provider: "google",
redirectUri: "https://yourapp.com/auth/callback"
});
// Redirect user to provider
window.location.href = url;
// Handle callback
const { user, session } = await nexbic.auth.oauth.callback({
provider: "google",
code: "oauth_code_from_provider"
});curl -X POST https://api.nexbic.dev/v1/auth/oauth/google \
-H "Content-Type: application/json" \
-H "X-API-Key: nxb_sk_..." \
-d '{
"redirect_uri": "https://yourapp.com/auth/callback"
}'Explore wallet integration, webhooks, and more in the Nexbic developer docs.