@ovixa/auth-client 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +51 -16
  3. package/package.json +2 -6
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## [0.1.1] - 2026-01-28
9
+
10
+ ### Added
11
+
12
+ - Documentation for `PASSWORD_RESET_REQUIRED` error code (403)
13
+ - Guidance on handling forced password reset in login and token refresh flows
14
+
8
15
  ## [0.1.0] - 2026-01-26
9
16
 
10
17
  ### Added
package/README.md CHANGED
@@ -418,22 +418,57 @@ try {
418
418
 
419
419
  ### Error Codes
420
420
 
421
- | Code | Description |
422
- | --------------------- | ----------------------------------- |
423
- | `INVALID_CREDENTIALS` | Wrong email or password |
424
- | `EMAIL_NOT_VERIFIED` | User must verify email before login |
425
- | `INVALID_TOKEN` | Token is invalid or malformed |
426
- | `TOKEN_EXPIRED` | Token has expired |
427
- | `INVALID_SIGNATURE` | Token signature verification failed |
428
- | `INVALID_ISSUER` | Token issuer doesn't match |
429
- | `INVALID_AUDIENCE` | Token audience doesn't match |
430
- | `RATE_LIMITED` | Too many requests |
431
- | `NETWORK_ERROR` | Failed to reach auth service |
432
- | `BAD_REQUEST` | Invalid request parameters |
433
- | `UNAUTHORIZED` | Authentication required |
434
- | `FORBIDDEN` | Access denied |
435
- | `NOT_FOUND` | Resource not found |
436
- | `SERVER_ERROR` | Auth service error |
421
+ | Code | Description |
422
+ | ------------------------- | -------------------------------------------- |
423
+ | `INVALID_CREDENTIALS` | Wrong email or password |
424
+ | `EMAIL_NOT_VERIFIED` | User must verify email before login |
425
+ | `PASSWORD_RESET_REQUIRED` | Account flagged for mandatory password reset |
426
+ | `INVALID_TOKEN` | Token is invalid or malformed |
427
+ | `TOKEN_EXPIRED` | Token has expired |
428
+ | `INVALID_SIGNATURE` | Token signature verification failed |
429
+ | `INVALID_ISSUER` | Token issuer doesn't match |
430
+ | `INVALID_AUDIENCE` | Token audience doesn't match |
431
+ | `RATE_LIMITED` | Too many requests |
432
+ | `NETWORK_ERROR` | Failed to reach auth service |
433
+ | `BAD_REQUEST` | Invalid request parameters |
434
+ | `UNAUTHORIZED` | Authentication required |
435
+ | `FORBIDDEN` | Access denied |
436
+ | `NOT_FOUND` | Resource not found |
437
+ | `SERVER_ERROR` | Auth service error |
438
+
439
+ ### Handling `PASSWORD_RESET_REQUIRED`
440
+
441
+ When an administrator flags an account as compromised, login and token refresh will return a `403` error with code `PASSWORD_RESET_REQUIRED`. The user must complete a password reset before they can log in again.
442
+
443
+ ```typescript
444
+ try {
445
+ const tokens = await auth.login({ email, password });
446
+ } catch (error) {
447
+ if (error instanceof OvixaAuthError) {
448
+ if (error.code === 'PASSWORD_RESET_REQUIRED') {
449
+ // Redirect user to password reset flow
450
+ await auth.forgotPassword({ email });
451
+ // Show message: "Your account requires a password reset. Check your email."
452
+ return;
453
+ }
454
+ // Handle other errors...
455
+ }
456
+ }
457
+ ```
458
+
459
+ This also applies to token refresh - if you're using automatic token refresh in middleware, handle this error to redirect users to the password reset flow:
460
+
461
+ ```typescript
462
+ try {
463
+ const newTokens = await auth.refreshToken(refreshToken);
464
+ } catch (error) {
465
+ if (error instanceof OvixaAuthError && error.code === 'PASSWORD_RESET_REQUIRED') {
466
+ // Clear cookies and redirect to login with a message
467
+ clearAuthCookies();
468
+ redirect('/login?reason=password_reset_required');
469
+ }
470
+ }
471
+ ```
437
472
 
438
473
  ## Types
439
474
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovixa/auth-client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Client SDK for Ovixa Auth service",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,11 +57,7 @@
57
57
  "express"
58
58
  ],
59
59
  "license": "MIT",
60
- "repository": {
61
- "type": "git",
62
- "url": "https://github.com/ovixa/platform.git",
63
- "directory": "packages/auth-client"
64
- },
60
+ "homepage": "https://www.npmjs.com/package/@ovixa/auth-client",
65
61
  "publishConfig": {
66
62
  "access": "public"
67
63
  },