Skip to content

Installation

Install the Neuctra Authix SDK and create a reusable authentication instance. Sessions are handled automatically using secure cookie-based authentication.

Package Installation

npm install @neuctra/authix

Create Neuctra Authix Instance

Create a single authixInit.js file and reuse it across your app.

JavaScript
1// src/authixInit.js
2
3import { NeuctraAuthix } from "@neuctra/authix";
4
5export const authix = new NeuctraAuthix({
6  baseUrl: "https://server.authix.neuctra.com/api",
7
8  // Publishable key: safe in browser and mobile code once the app's allowed
9  // origins are set. Server code uses a secret key (sk_live_…) from an
10  // environment variable instead — never ship that one to a client.
11  apiKey: "pk_live_xxxxxxxx_xxxxxxxxxxxxxxxx",
12  appId: "YOUR_NEUCTRA_AUTHIX_APP_ID",
13});

Usage Example

JavaScript
1import { authix } from "./authixInit";
2
3// Login Example
4export const login = async (email, password) => {
5  try {
6    return await authix.loginUser({ email, password });
7  } catch (err) {
8    console.error(err?.message || err);
9    throw err;
10  }
11};
12
13// Signup Example
14export const signup = async (
15  name,
16  email,
17  password,
18  role = "user",
19  avatarUrl = null
20) => {
21  try {
22    return await authix.signupUser({
23      name,
24      email,
25      password,
26      role,
27      avatarUrl,
28    });
29  } catch (err) {
30    console.error(err?.message || err);
31    throw err;
32  }
33};

Configuration

ParameterDescription
baseUrlOfficial Neuctra Authix API endpoint (https://server.authix.neuctra.com/api)
apiKeyA publishable key (pk_live_…) in browser and mobile code — it reaches only sign-in flows, app data reads and the signed-in user's own account. A secret key (sk_live_…) with full account authority on your server only; Authix refuses it from a browser.
appIdUnique application identifier

Next Steps

Continue with Authentication, User Management, and SDK Reference to fully integrate Neuctra Authix into your application.