npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

authme-vue

v1.0.1

Published

Vue SDK for AuthMe Identity and Access Management Server

Downloads

135

Readme

authme-vue

Vue 3 SDK for AuthMe — composables, a Vue plugin, Vue Router guard, and an AuthProvider component.

Installation

npm install authme-vue authme-sdk vue

Quick Start

1. Install the plugin

// main.ts
import { createApp } from 'vue';
import { AuthmePlugin } from 'authme-vue';
import App from './App.vue';

const app = createApp(App);

app.use(AuthmePlugin, {
  url: 'http://localhost:3000',
  realm: 'my-realm',
  clientId: 'my-app',
  redirectUri: 'http://localhost:5173/callback',
});

app.mount('#app');

2. Use useAuth in components

<script setup lang="ts">
import { useAuth } from 'authme-vue';

const { isAuthenticated, user, login, logout, isLoading } = useAuth();
</script>

<template>
  <div v-if="isLoading">Loading...</div>
  <div v-else-if="isAuthenticated">
    Hello, {{ user?.name }}
    <button @click="logout">Sign out</button>
  </div>
  <div v-else>
    <button @click="login()">Sign in</button>
  </div>
</template>

3. Protect routes with the navigation guard

// router/index.ts
import { createRouter, createWebHistory } from 'vue-router';
import { createAuthGuard } from 'authme-vue';
import { AuthmeClient } from 'authme-sdk';

const authClient = new AuthmeClient({
  url: 'http://localhost:3000',
  realm: 'my-realm',
  clientId: 'my-app',
  redirectUri: 'http://localhost:5173/callback',
});

const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: '/', component: Home },
    {
      path: '/dashboard',
      component: Dashboard,
      meta: { requiresAuth: true },
    },
    {
      path: '/admin',
      component: Admin,
      meta: { requiresAuth: true, roles: ['admin'] },
    },
  ],
});

router.beforeEach(createAuthGuard({ loginRoute: '/login' }, authClient));

export default router;

4. AuthProvider component (scoped context)

<!-- App.vue -->
<template>
  <AuthProvider
    url="http://localhost:3000"
    realm="my-realm"
    client-id="my-app"
    redirect-uri="http://localhost:5173/callback"
  >
    <RouterView />
  </AuthProvider>
</template>

<script setup lang="ts">
import { AuthProvider } from 'authme-vue';
</script>

5. Permissions

<script setup lang="ts">
import { usePermissions } from 'authme-vue';

const { hasRole, hasPermission, roles } = usePermissions();
</script>

<template>
  <AdminPanel v-if="hasRole('admin')" />
</template>

API Reference

Plugin

  • AuthmePlugin — Vue plugin, call app.use(AuthmePlugin, AuthmeConfig)

Composables

  • useAuth(){ isAuthenticated, user, isLoading, login, logout, getToken, client }
  • useUser(){ user, isLoading, refresh }
  • usePermissions(){ hasRole, hasPermission, roles }

Navigation Guard

  • createAuthGuard(options?, client?) — returns a NavigationGuard
    • options.loginRoute — redirect path (default: '/login')
    • options.roles — global required roles

Components

  • <AuthProvider> — provides auth context to a component subtree

License

MIT