@pelygo/auth
| Install | |
|---|---|
npm install @pelygo/auth |
|
| Latest Version: | 1.3.0 |
| Vue: | 3 |
| License: | Custom |
| Last Updated: | Sep 28, 2026 |
| Links: | npm |
@pelygo/auth
Sign-in, the signed-in user, and the chosen client for VCOMSUITE apps, in Vue 3 or React. Every Vcomsuite app uses it, so sign-in and client choice work the same everywhere.
Start here
| You are… | Read |
|---|---|
| Building an app with an AI tool (Antigravity, Claude, Base44) | docs/guide/: step-by-step pages with prompts to paste |
| An AI coding agent | AGENTS.md first, then docs/ai/ (rules, recipes, every export) |
| An engineer | docs/reference/vue.md or docs/reference/react.md, and docs/ai/api.md |
| Maintaining this package | docs/maintainers/DEVELOPMENT.md (in the repository, not the package) |
All of these ship inside the package too, under node_modules/@pelygo/auth/.
The code in dist/ is readable and has a comment on every export.
Install
npm install @pelygo/auth
Vue apps also need vue 3, pinia 2 or 3 and vue-router 4. React apps need
react 18 or 19. These are optional peer dependencies: install the ones your
app uses.
Quick start (Vue)
// src/stores/auth.ts
import { createAuthStore } from '@pelygo/auth/vue';
export const useAuthStore = createAuthStore();
// src/main.ts
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { configure } from '@pelygo/auth/core';
import { authPlugin } from '@pelygo/auth/vue';
import App from './App.vue';
import router from './router';
import { useAuthStore } from './stores/auth';
configure({
apiBaseUrl: import.meta.env.VITE_JANUS_API_URL,
authBaseUrl: import.meta.env.VITE_AUTH_BASE_URL,
});
createApp(App).use(createPinia()).use(authPlugin, { store: useAuthStore }).use(router).mount('#app');
Then protect routes with createAuthGuard({ getAuthStore: () => useAuthStore() })
and route meta (isLoginPage, requiresAuth, requiresClient, adminOnly),
and use the ready-made LoginForm and SelectClientForm. The full setup is in
docs/ai/recipes/vue/01-setup.md. For
React, see docs/ai/recipes/react/01-setup.md.
How it works, in brief
- Two ways to sign in. On the Vcomsuite hub's addresses (
vcomsuite.io,dev.,staging.,demo.vcomsuite.io) people sign in once at the hub, and every app on that address shares the sign-in. Anywhere else (your own computer, hosted previews) the app shows its own login form, which signs in against the same real sign-in server. - Clients. A client is the customer account someone is working on. Admins may open any client; other users pick from their own list, and a user with exactly one client gets it automatically. The choice is kept per browser tab.
- API calls.
createAuthApi()(or the Vue store'sgetApi()) adds the sign-in token to each request and handles an expired session: it signs the person out, tells them, and sends them to sign in. - Sign-out ends the session for every app on the same address, in every tab. The package only removes its own stored data; the app's own data is left alone.
- Admin is the only role the package knows, and it's for showing and hiding things. The API must check permissions.
Details: docs/ai/storage-and-sso.md.
Entry points
| Import | What |
|---|---|
@pelygo/auth/core (also @pelygo/auth) |
configure(), createAuthApi(), sign-in state, cross-app links, hub sign-in, session expiry |
@pelygo/auth/vue |
Pinia store, router guards, composables, LoginForm, SelectClientForm |
@pelygo/auth/react |
AuthProvider, hooks, LoginForm, SelectClientForm |
Changes
See CHANGELOG.md. 1.2.0 changes some behaviour (hub sign-in on Vcomsuite, what sign-out clears, sign-in error messages); read its "check before upgrading" list.
License
Proprietary. Licensed exclusively for use in authorised VCOMSUITE applications. See LICENSE for details.
Related Packages
Auth client for browser apps. Cookies + automatic refresh + React and Vue 3 adap...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.3.0 | ^3.0.0 | Custom | |
| 1.2.1 | ^3.0.0 | Custom | |
| 1.2.0 | ^3.0.0 | Custom | |
| 1.1.0 | ^3.0.0 | Custom | |
| 1.0.0 | ^3.0.0 | Custom | |
| 0.2.7 | ^3.0.0 | Custom | |
| 0.2.6 | ^3.0.0 | Custom | |
| 0.2.5 | ^3.0.0 | Custom | |
| 0.2.4 | ^3.0.0 | Custom | |
| 0.2.3 | ^3.0.0 | Custom | |
| 0.2.2 | ^3.0.0 | Custom | |
| 0.2.1 | ^3.0.0 | Custom | |
| 0.2.0 | ^3.0.0 | Custom | |
| 0.1.0 | ^3.0.0 | Custom | |
| 0.0.8 | ^3.0.0 | Custom | |
| 0.0.7 | ^3.0.0 | Custom | |
| 0.0.6 | ^3.0.0 | Custom | |
| 0.0.5 | ^3.0.0 | Custom | |
| 0.0.3 | ^3.0.0 | Custom | |
| 0.0.2 | ^3.0.0 | Custom |