Registry / auth-security / mogh_auth_client

mogh_auth_client

JSON →
library1.3.0jsnpmunverified

Mogh Auth Client is a TypeScript library for authenticating with the Mogh authentication service, version 1.3.0. It supports token-based authentication and session management. The package ships with TypeScript types and is intended for use in Node.js or browser environments. It is maintained by the MoghTech team with a focus on security and ease of integration.

npm install mogh_auth_client
INSTALL
IMPORT
SIG · MOGH_AUTH_CLIENT
M
mogh_auth_client
auth-securityjavascriptv1.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MoghAuthClient
import { MoghAuthClient } from 'mogh_auth_client'
import MoghAuthClient from 'mogh_auth_client'
Default export not available; must use named import. This is a class that requires instantiation with config.
MoghAuthClient
const { MoghAuthClient } = require('mogh_auth_client')
const MoghAuthClient = require('mogh_auth_client')
CommonJS requires destructured require for named export. Only works if package supports CJS.
MoghAuthClientOptions
import type { MoghAuthClientOptions } from 'mogh_auth_client'
Type-only import for options interface, available since v1.2.0.
MoghAuthClient
import { MoghAuthClient } from 'mogh_auth_client'
const client = new MoghAuthClient()
Constructor requires configuration object with 'apiKey' and 'endpoint'.

Creates a MoghAuthClient instance and authenticates a user with email and password, then logs the access token.

import { MoghAuthClient } from 'mogh_auth_client'; const client = new MoghAuthClient({ apiKey: process.env.MOGH_API_KEY ?? '', endpoint: 'https://auth.mogh.io/v1' }); async function authenticate() { try { const result = await client.authenticate({ username: 'user@example.com', password: 'securepassword' }); console.log('Access Token:', result.accessToken); } catch (error) { console.error('Auth failed:', error); } } authenticate();
Debug
Known issues
breakingIn v1.3.0, the constructor options changed: 'apiKey' replaced 'clientId'. Old code using 'clientId' will fail.
fix
Update constructor call: new MoghAuthClient({ apiKey: '...' }) instead of { clientId: '...' }.
affects: <1.3.0
deprecatedThe 'authenticate' method's callback style is deprecated. Use async/await or Promises as of v1.2.0.
fix
Replace callbacks with async/await: const result = await client.authenticate(...).
affects: >=1.2.0
gotchaThe package requires axios as a peer dependency but does not list it in 'dependencies' in package.json. If axios is not installed, runtime error occurs.
fix
Install axios: npm install axios
affects: >=1.0.0
gotchaThe 'endpoint' option must not have a trailing slash. Including it may cause unexpected 404 errors.
fix
Ensure endpoint is like 'https://auth.mogh.io/v1' without trailing slash.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'axios'
Axios is a peer dependency that is not automatically installed.
fix
Run 'npm install axios' in your project.
TypeError: client.authenticate is not a function
Using default import instead of named import, resulting in undefined class method.
fix
Use import { MoghAuthClient } from 'mogh_auth_client'.
HttpError: 401 Unauthorized
API key is invalid or not provided.
fix
Check that the apiKey in constructor is correct and set via environment variable.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
axiosrequiredPerforming HTTP requests to the Mogh auth server
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
mogh_auth_client — npm install mogh_auth_client · libregistry