
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@securegraph/sg-nuxt-jwt-sso-bridge
Advanced tools
JWT-based SSO bridge client for Nuxt 3. Connects to external JWT authentication servers with automatic token refresh and session management.
A JWT-based SSO bridge client for Nuxt 3 applications. This module connects your Nuxt app to an external JWT authentication server with a specific authentication flow:
/auth/login
, /auth/verify
, /auth/heartbeat
endpointsnpm install sg-nuxt-jwt-sso-bridge
# or
yarn add sg-nuxt-jwt-sso-bridge
# or
pnpm add sg-nuxt-jwt-sso-bridge
# .env
SSO_BASE_URL=https://auth.example.com
SSO_APP_URL=https://myapp.example.com
export default defineNuxtConfig({
modules: ['sg-nuxt-jwt-sso-bridge'],
// Optional: Override default settings
sso: {
heartbeatInterval: 840000, // Session refresh interval (ms)
tokenCookieName: 'auth-token', // Cookie name for token storage
protectedRoutes: ['/dashboard', '/admin'], // Routes requiring auth
publicRoutes: ['/', '/login', '/about'], // Public routes
// Default login page settings (optional)
useDefaultLoginPage: true, // Use built-in login page (default: true)
loginPagePath: '/login', // Path for login page (default: '/login')
loginPageOptions: {
title: 'Sign in to continue',
subtitle: 'Welcome to our application',
buttonText: 'Sign in with Google',
organizationName: 'Your Company'
},
// Token expiration handling (optional)
onTokenExpired: 'redirect', // 'redirect' | 'reload' | 'none' (default: 'redirect')
tokenExpiredRedirectPath: '/login', // Redirect path for expired tokens
tokenExpiredMessage: 'Your session has expired', // Optional message to show
// Callback redirect (optional)
callbackRedirectPath: '/' // Default redirect after successful login (default: '/')
}
})
The module automatically provides:
/login
sso-auth
)useSSO()
composableNo additional code required!
Just add the module to your config and protect your routes:
<script setup>
// pages/dashboard.vue - This page is protected
definePageMeta({
middleware: 'sso-auth' // Users will be redirected to /login if not authenticated
})
const { user } = useSSO()
</script>
<template>
<div>
<h1>Welcome, {{ user?.name }}!</h1>
</div>
</template>
<script setup>
const { user, isAuthenticated, login, logout } = useSSO()
</script>
<template>
<div>
<div v-if="isAuthenticated">
Welcome, {{ user?.name }}!
<button @click="logout">Logout</button>
</div>
<div v-else>
<button @click="login">Login</button>
</div>
</div>
</template>
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['sg-nuxt-jwt-sso-bridge'],
sso: {
loginPageOptions: {
title: 'Welcome Back',
subtitle: 'Sign in to access your dashboard',
buttonText: 'Continue with Google',
customLogo: '/logo.png',
organizationName: 'Acme Corp'
}
}
})
<script setup>
// This page requires authentication
definePageMeta({
middleware: 'sso-auth'
})
const { user } = useSSO()
</script>
<template>
<div>
<h1>Dashboard</h1>
<p>Hello, {{ user?.email }}</p>
</div>
</template>
const { verifyToken } = useSSO()
// Verify a token manually
const isValid = await verifyToken(token)
The module provides a simple verifyJWT
function for server-side token verification:
// server/api/protected.get.ts
export default defineEventHandler(async (event) => {
// Get token from header or cookie
const token = getHeader(event, 'authorization')?.replace('Bearer ', '')
// or: getCookie(event, 'auth-token')
// Verify token
const result = await verifyJWT(token)
if (!result.valid) {
throw createError({
statusCode: 401,
statusMessage: result.error || 'Unauthorized'
})
}
return {
user: result.user,
data: 'Protected data'
}
})
The verifyJWT
function is automatically available in your server routes - no import needed:
export default defineEventHandler(async (event) => {
const token = getCookie(event, 'auth-token')
const { valid, user } = await verifyJWT(token)
if (!valid) {
return { error: 'Please login' }
}
return { user, data: '...' }
})
export default defineEventHandler(async (event) => {
const token = getCookie(event, 'auth-token')
const { valid, user } = await verifyJWT(token)
return {
publicData: 'Everyone can see this',
...(user && { userData: user })
}
})
If auto-import doesn't work, you can import it directly:
import { verifyJWT } from '@securegraph/sg-nuxt-jwt-sso-bridge/runtime/server/utils/verifyJWT'
interface VerifyResponse {
valid: boolean
user?: any // User object from JWT
error?: string // Error message if invalid
}
<script setup>
const { user, loading, checked } = useSSO()
</script>
<template>
<div>
<!-- Show loading while authentication is being checked -->
<div v-if="loading">Checking authentication...</div>
<!-- Show content only after check is complete -->
<div v-else>
<div v-if="user">
Welcome, {{ user.name }}!
</div>
<div v-else>
Please login to continue
</div>
</div>
</div>
</template>
Configure how the module handles expired tokens:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['sg-nuxt-jwt-sso-bridge'],
sso: {
// Redirect to login page on token expiration (default)
onTokenExpired: 'redirect',
tokenExpiredRedirectPath: '/login',
tokenExpiredMessage: 'Session expired, please login again',
// OR: Reload the page
// onTokenExpired: 'reload',
// OR: Do nothing (handle manually)
// onTokenExpired: 'none'
}
})
The main composable for authentication operations.
user
- Reactive reference to current user objectisAuthenticated
- Reactive reference to authentication statechecked
- Reactive reference to authentication check completion statusloading
- Reactive reference to loading state (inverse of checked)login(returnTo?: string)
- Function to initiate login flow with optional return URLlogout()
- Function to logout userverifyToken(token: string)
- Function to verify a JWT tokenheartbeat()
- Function to refresh sessionhandleCallback(token: string, returnTo?: string)
- Function to handle OAuth callback with optional return URLThis module is designed to work with a specific JWT-based SSO server architecture that implements:
GET /auth/login?return_to={url}
- Initiates OAuth login flowPOST /auth/verify
- Verifies JWT tokens
{ token: string }
{ valid: boolean, user: object }
GET /auth/heartbeat
- Refreshes session tokens
Authorization: Bearer {token}
{ success: boolean, token: string, user: object }
GET /auth/callback
- Handles OAuth provider callbacksGET /auth/bridge
- Bridge page for cross-domain token exchange/login?return_to=/original-page
/auth/callback?token=xxx&return_to=/original-page
onTokenExpired
setting:
redirect
: Navigate to login page with optional messagereload
: Refresh the entire pagenone
: Clear auth state, let app handle it@nuxtjs/oauth
instead)nuxt-saml
instead)Variable | Required | Description |
---|---|---|
SSO_BASE_URL | Yes | Base URL of your SSO service |
SSO_APP_URL | No | Your application URL (default: http://localhost:3000) |
# Install dependencies
yarn install
# Run tests
yarn test
# Build module
yarn prepack
# Run dev server
yarn dev
UNLICENSED - This package is proprietary software. All rights reserved.
For questions about this module, please contact your system administrator or the package maintainer.
This module is specifically designed for JWT-based SSO bridge architecture.
For other authentication needs, consider:
@nuxtjs/oauth
@nuxtjs/auth-next
@clerk/nuxt
@nuxtjs/supabase
@nuxtjs/firebase
@nuxtjs/auth-next
FAQs
JWT-based SSO bridge client for Nuxt 3. Connects to external JWT authentication servers with automatic token refresh and session management.
The npm package @securegraph/sg-nuxt-jwt-sso-bridge receives a total of 11 weekly downloads. As such, @securegraph/sg-nuxt-jwt-sso-bridge popularity was classified as not popular.
We found that @securegraph/sg-nuxt-jwt-sso-bridge demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.