UNPKG

@lucasroll62/nuxt3-auth

Version:

An alternative module to @nuxtjs/auth

44 lines (43 loc) 944 B
import { assignDefaults, assignAbsoluteEndpoints } from "../utils/provider"; export function laravelJWT(nuxt, strategy) { const { url } = strategy; if (!url) { throw new Error("url is required for laravel jwt!"); } const DEFAULTS = { name: "laravelJWT", scheme: "laravelJWT", endpoints: { login: { url: url + "/api/auth/login" }, refresh: { url: url + "/api/auth/refresh" }, logout: { url: url + "/api/auth/logout" }, user: { url: url + "/api/auth/user" } }, token: { property: "access_token", maxAge: 3600 }, refreshToken: { property: false, data: false, maxAge: 1209600, required: false, tokenRequired: true }, user: { property: false }, clientId: false, grantType: false }; assignDefaults(strategy, DEFAULTS); assignAbsoluteEndpoints(strategy); }