
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
vue-auth-sanctum
Advanced tools
A Vue 3 plugin for authentication using Laravel Sanctum.
To install the package, run the following command:
npm install vue-auth-sanctum
Add the plugin in your main.ts
or main.js
file, and provide the required options.
import { createApp } from 'vue';
import App from './App.vue';
import { vueAuthSanctum } from 'vue-auth-sanctum';
const authConfig = {
apiURL: 'http://localhost:8000',
mode: 'cookie', // Optional: 'cookie' or 'token'
endpoints: {
csrf: '/sanctum/csrf-cookie',
login: '/login',
logout: '/logout',
user: '/api/user',
},
csrf: {
cookie: 'XSRF-TOKEN',
header: 'X-XSRF-TOKEN',
}
};
const app = createApp(App);
app.use(vueAuthSanctum, authConfig);
app.mount('#app');
To authenticate a user you should pass the credentials payload as an argument to the login method. The payload should contain all fields required by your Laravel Sanctum backend.
views/Login.vue
import {ref} from 'vue';
import { useSanctumAuth } from 'vue-auth-sanctum';
const { login } = useSanctumAuth();
const userCredentials = ref({
email: 'user@mail.com',
password: '123123',
});
await login(userCredentials.value);
This composable provides access to the current authenticated user. It supports generic types, so you can get the user as any class you want.
views/Dashboard.vue
import { useSanctumUser } from 'vue-auth-sanctum';
const user = useSanctumUser();
FAQs
A Vue 3 plugin for authentication using Laravel Sanctum.
The npm package vue-auth-sanctum receives a total of 0 weekly downloads. As such, vue-auth-sanctum popularity was classified as not popular.
We found that vue-auth-sanctum demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket investigates hidden protestware in npm packages that blocks user interaction and plays the Ukrainian anthem for Russian-language visitors.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.