Registry / auth-security / vue-aspnet-auth

vue-aspnet-auth

JSON →
library1.5.4jsnpmunverified

Vue-aspnet-auth is a Vue.js plugin designed to integrate authentication with ASP.NET OWIN MVC backends. It acts as a wrapper around the `aspnet-auth` library, providing a convenient way to manage user login, logout, and token handling within a Vue application. The package is currently at version 1.5.4, released in May 2019. Its release cadence was inconsistent even during its active period, and it appears to be abandoned, with no significant updates or commits since 2019. Key differentiators include its specific focus on OWIN-based ASP.NET authentication, which distinguishes it from more generic JWT or OAuth client libraries, though this also ties it to an older backend technology stack. Due to its abandonment, it is not suitable for new projects and may pose security risks or compatibility challenges with modern Vue or JavaScript environments.

npm install vue-aspnet-auth
INSTALL
IMPORT
SIG · VUE-ASPNET-AUTH
V
vue-aspnet-auth
auth-securityjavascriptv1.5.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AspnetAuth
import { AspnetAuth } from 'vue-aspnet-auth';
import AspnetAuth from 'vue-aspnet-auth';
The plugin is exported as a named export. It is used with `Vue.use()`.
$auth
this.$auth.login(username, password, callback);
const auth = new AspnetAuth(); auth.login(...);
After `Vue.use(AspnetAuth)`, the authentication instance is made available globally on Vue instances via `this.$auth`.
Vue
import Vue from 'vue';
const Vue = require('vue');
The plugin is designed for Vue 2.x and expects Vue to be imported for `Vue.use()`.

This quickstart demonstrates how to install and initialize the `vue-aspnet-auth` plugin, then use its `$auth` instance for user login within a basic Vue component. It also shows how to dynamically set the base URL for API requests and handles potential login errors.

import Vue from 'vue'; import { AspnetAuth } from 'vue-aspnet-auth'; Vue.use(AspnetAuth, { url: 'http://localhost:46993' // Replace with your ASP.NET backend URL }); // Example Vue component demonstrating login export default { name: 'login-component', data() { return { username: '', password: '', error: null }; }, methods: { login() { this.$auth.login(this.username, this.password, (data) => { if (data.result) { console.log('Login successful:', this.$auth.authentication); // Example: Redirect or update store // this.$store.commit('auth', this.$auth.authentication); // this.$root.$emit('app.loggedin'); } else { this.error = data.message || 'Login failed.'; console.error('Login failed:', this.error); } }); }, logout() { this.$auth.logout(); console.log('Logged out.'); } }, created() { // Can dynamically update the URL if needed, though better set during Vue.use() // this.$auth.url = `http://localhost:1234`; console.log('Auth plugin initialized. Current URL:', this.$auth.url); }, template: ` <div> <h2>Login</h2> <form @submit.prevent="login"> <input type="text" v-model="username" placeholder="Username" /> <input type="password" v-model="password" placeholder="Password" /> <button type="submit">Login</button> </form> <p v-if="error" style="color: red;">{{ error }}</p> <button @click="logout">Logout</button> </div> ` };
Debug
Known issues
breakingThe package is abandoned and has not received updates since May 2019. It is highly likely to have compatibility issues with newer versions of Vue (e.g., Vue 3) or modern JavaScript build tools and environments.
fix
Do not use this package for new projects. For existing projects, consider migrating to a actively maintained authentication solution. If forced to use, thorough testing in your specific environment is crucial.
affects: >=1.5.4
gotchaThe `options` constructor for the plugin was introduced in v1.5.0, consolidating previous scattered options. Older versions might require different configuration methods.
fix
Ensure you are on v1.5.0 or higher to use the options object during plugin installation (`Vue.use(AspnetAuth, { url: '...' })`). Refer to the changelog for details if using an older version.
affects: <1.5.0
breakingThe plugin is tied to ASP.NET OWIN MVC backend authentication, a technology that is less common in new .NET development. This specialization limits its applicability to non-OWIN authentication systems.
fix
This is a fundamental design choice. If your backend is not ASP.NET OWIN MVC, this plugin is not suitable. Consider libraries for JWT, OAuth2, or OIDC that are backend-agnostic.
affects: >=1.0.0
gotchaThe changelog indicates several dependency updates, including fixing a vulnerable version of `ssri` in v1.5.3. Given the package is abandoned, there's a high risk of unpatched security vulnerabilities in its dependencies.
fix
Do not use in production. If legacy systems require it, perform a comprehensive security audit of all transitive dependencies and consider manually patching vulnerable packages at your own risk. Use npm audit for initial checks.
affects: <1.5.3
Errors
Common errors & fixes
`this.$auth` is undefined in my Vue component.
The `vue-aspnet-auth` plugin was not correctly installed via `Vue.use()` or the component is instantiated before the plugin.
fix
Ensure `import Vue from 'vue'; import { AspnetAuth } from 'vue-aspnet-auth'; Vue.use(AspnetAuth, { url: 'your-backend-url' });` is called at the very beginning of your application's entry point (e.g., `main.js`), before any Vue components are initialized.
Error: `TypeError: Cannot read property 'install' of undefined` when calling `Vue.use(AspnetAuth)`.
This error typically means `AspnetAuth` was imported incorrectly or the package itself is corrupted/missing the `install` method expected by `Vue.use()`.
fix
Verify the import statement: `import { AspnetAuth } from 'vue-aspnet-auth';`. Ensure `vue-aspnet-auth` is correctly installed (`npm install vue-aspnet-auth --save`) and that the `AspnetAuth` object itself has an `install` method (which it should as a Vue plugin).
`[Vue warn]: The plugin 'AspnetAuth' has been registered multiple times.`
The `Vue.use(AspnetAuth)` statement is being executed more than once, possibly due to hot-reloading in development or incorrect application setup.
fix
Ensure `Vue.use(AspnetAuth)` is called only once in your application's lifecycle, typically in `main.js` or equivalent. For development, check if your hot-reloading setup is re-executing global setup code.
Upgrade
Version history
1.5.4latest on npm
Audit
Dependencies
aspnet-authrequiredCore authentication logic is provided by this underlying library.
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
vue-aspnet-auth — npm install vue-aspnet-auth · libregistry