Installation

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

Package Installation

1npm 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  // Browser-safe. Use your secret key (sk_live_…) only on a server.
9  publishableKey: "pk_live_xxxxxxxx_xxxxxxxxxxxxxxxx",
10  appId: "YOUR_NEUCTRA_AUTHIX_APP_ID",
11});

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)
publishableKeyBrowser-safe key (pk_live_…). Scoped to end-user auth and the signed-in user's own data. Provide this OR secretKey.
secretKeyServer-only key (sk_live_…) with full account authority. Never include it in client code. Provide this OR publishableKey.
appIdUnique application identifier

Next Steps

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