UIT Metro Universal Auth Library
raw JSON → 1.1.17 verified Sat Apr 25 auth: no javascript
A corporate authentication library (v1.1.17) for Metro (METRO/MAKRO) loyalty card applications. It provides a pre-built UI flow for phone number entry, SMS code verification, card selection, registration, and manual card linking. The library requires a recaptcha v3 key and an authorization token. It is proprietary (Russian-language docs only) and intended solely for internal Metro use. No release cadence documented; single-version package with limited community adoption. Differentiators: bundled CSS and callbacks for each step, but dependency on Metro-specific APIs and lack of ESM/TypeScript support (no typings) make it unsuitable for general use.
Common errors
error ERR_MODULE_NOT_FOUND: Cannot find package 'uit-metro-universal-auth-library' imported from ... ↓
cause Package not installed or missing from node_modules; also may be due to ESM-only resolution.
fix
Run
npm install uit-metro-universal-auth-library and ensure your project uses ESM (e.g., "type": "module" in package.json). error TypeError: AuthInit is not a constructor ↓
cause Wrong import style: default import attempted but package exports named export.
fix
Use
import { AuthInit } from 'uit-metro-universal-auth-library'; instead of import AuthInit from .... error Module not found: Can't resolve 'uit-metro-universal-auth-library/dist/styles/main.css' ↓
cause CSS file path is incorrect or missing side-effect import.
fix
Use
import 'uit-metro-universal-auth-library/dist/styles/main.css'; — no named import. Warnings
breaking Package is not available on npm publicly (scoped or private registry required). ↓
fix Ensure you have access to the private npm registry and are logged in with correct credentials.
gotcha All strings and labels are in Russian; no i18n support provided. ↓
fix Override texts via the initParams.texts object; for other languages, you must provide translations.
deprecated The default text values may change between minor versions without notice. ↓
fix Explicitly set all text fields in initParams to avoid unexpected UI changes.
Install
npm install uit-metro-universal-auth-library yarn add uit-metro-universal-auth-library pnpm add uit-metro-universal-auth-library Imports
- AuthInit wrong
const { AuthInit } = require('uit-metro-universal-auth-library');correctimport { AuthInit } from 'uit-metro-universal-auth-library'; - styles wrong
import { styles } from 'uit-metro-universal-auth-library';correctimport 'uit-metro-universal-auth-library/dist/styles/main.css'; - AuthInit (default import) wrong
import { AuthInit } from 'uit-metro-universal-auth-library';correctimport AuthInit from 'uit-metro-universal-auth-library';
Quickstart
import { AuthInit } from 'uit-metro-universal-auth-library';
import 'uit-metro-universal-auth-library/dist/styles/main.css';
const initParams = {
env: 'development',
authorizationKey: process.env.AUTH_KEY ?? '',
recaptchaKey: process.env.RECAPTCHA_KEY ?? '',
texts: {
registrationFormTitle: 'Зарегистрироваться'
},
callbacks: {
authModalOpened: () => console.log('Modal opened'),
smsCodeSended: (request, response) => console.log('SMS sent', response),
registrationCompleted: (request, response, formState) => {
console.log('Registration completed', formState);
}
}
};
const auth = new AuthInit(initParams);
auth.init(); // start authentication flow