0.3.12 • Published 4 months ago
@aleph-alpha/lib-auth v0.3.12
Aleph Alpha Lib Auth
@aleph-alpha/lib-auth
This project provides an adaptation of oidc-client-ts
with some guards you could use on vur-router or another routing of your preference.
npm install @aleph-alpha/lib-auth
pnpm add @aleph-alpha/lib-auth
Example setup for AuthManager
import { createAuthManager } from '@aleph-alpha/lib-auth'
export default createAuthManager(
'issuer',
'clientId',
'http:localhost:5173',
'/callback',
);
Example for Vue-Router with Guards
import authManager from 'your-path/auth';
import { guardForEntryPage, guardForCallbackPage } from '@aleph-alpha/lib-auth'
const routes = {
path: '/',
name: 'Home',
beforeEnter: (to, from, next) => {
guardForEntryPage(authManager, () => next());
},
},
{
path: '/callback',
name: 'LoginCallback',
beforeEnter: (to, from, next) => {
guardForCallbackPage(authManager, () => next());
},
},