
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
strapi-plugin-magic-sessionmanager
Advanced tools
Advanced Session Management for Strapi v5 - Track user sessions with IP geolocation, security scoring, and real-time monitoring
See who's logged into your Strapi app - and control their sessions!
Track logins, monitor active users, and secure your app with one simple plugin. No complicated setup required.

On your Strapi homepage:

What you see:

Click any session to see:

When viewing a user:

Easy configuration:

Advanced security:
When users login:
When users logout:
Session Timeout vs Manual Logout:
While users are active:
npm install strapi-plugin-magic-sessionmanager
Add this to config/plugins.ts:
export default () => ({
'magic-sessionmanager': {
enabled: true,
},
});
npm run build
npm run develop
http://localhost:1337/adminThat's it! You're done!
Your JWT tokens are encrypted before saving to database. Generate a key:
In Admin Panel:
.env fileOr generate manually:
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
Then add to .env:
SESSION_ENCRYPTION_KEY=your-key-here
Why? If someone hacks your database, they can't steal user sessions! 🔒
Dashboard Tab:
Need to kick someone out?
Even works if they have refresh tokens! (See below)
Click any session to see:
Users can login from:
Each login = separate session. You can see them all and logout each individually.
Inactive sessions are automatically cleaned up:
Admin kicks out a user
↓
User has "refresh token"
↓
User gets new login token automatically
↓
User is back in! 😱
Admin kicks out a user
↓
User tries to use refresh token
↓
Plugin blocks it! 🚫
↓
User MUST login again
How to enable:
Add to config/plugins.ts:
'users-permissions': {
config: {
jwtManagement: 'refresh', // Enable refresh tokens
sessions: {
accessTokenLifespan: 3600, // 1 hour
maxRefreshTokenLifespan: 2592000, // 30 days
},
},
}
What this does:
See where users login from:
Automatically check if IP is:
Block logins from:
Get alerts when:
The Session Manager uses Strapi's Email Plugin to send notifications. You need to configure an email provider first.
Choose one of these providers:
Option A: Nodemailer (Recommended)
npm install @strapi/provider-email-nodemailer
Option B: SendGrid
npm install @strapi/provider-email-sendgrid
Option C: Mailgun
npm install @strapi/provider-email-mailgun
Add to config/plugins.ts:
export default () => ({
// Email configuration
email: {
config: {
provider: 'nodemailer',
providerOptions: {
host: process.env.SMTP_HOST || 'smtp.gmail.com',
port: process.env.SMTP_PORT || 587,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD,
},
},
settings: {
defaultFrom: process.env.SMTP_DEFAULT_FROM || 'noreply@yourapp.com',
defaultReplyTo: process.env.SMTP_DEFAULT_REPLY_TO || 'support@yourapp.com',
},
},
},
// Session Manager configuration
'magic-sessionmanager': {
enabled: true,
},
});
Add to your .env file:
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_DEFAULT_FROM=noreply@yourapp.com
SMTP_DEFAULT_REPLY_TO=support@yourapp.com
For Gmail:
Trigger a suspicious login (e.g., use a VPN) and check if the email arrives!
Troubleshooting:
All Content-API endpoints require a valid JWT token in the Authorization header.
Users can only access their own sessions.
Returns all sessions for the authenticated user.
GET /api/magic-sessionmanager/my-sessions
Authorization: Bearer <JWT>
Response:
{
"data": [
{
"id": 41,
"documentId": "abc123xyz",
"sessionId": "sess_m5k2h_8a3b1c2d_f9e8d7c6",
"ipAddress": "192.168.1.100",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36...",
"loginTime": "2026-01-02T10:30:00.000Z",
"lastActive": "2026-01-02T13:45:00.000Z",
"logoutTime": null,
"isActive": true,
"deviceType": "desktop",
"browserName": "Chrome 143",
"osName": "macOS 10.15.7",
"geoLocation": null,
"securityScore": null,
"isCurrentSession": true,
"isTrulyActive": true,
"minutesSinceActive": 2
},
{
"id": 40,
"documentId": "def456uvw",
"sessionId": "sess_m5k1g_7b2a0c1d_e8d7c6b5",
"ipAddress": "10.0.0.50",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)...",
"loginTime": "2026-01-01T08:15:00.000Z",
"lastActive": "2026-01-01T12:00:00.000Z",
"logoutTime": null,
"isActive": true,
"deviceType": "mobile",
"browserName": "Safari",
"osName": "iOS 17",
"geoLocation": null,
"securityScore": null,
"isCurrentSession": false,
"isTrulyActive": false,
"minutesSinceActive": 1545
}
],
"meta": {
"count": 2,
"active": 1
}
}
Returns only the session associated with the current JWT token.
GET /api/magic-sessionmanager/current-session
Authorization: Bearer <JWT>
Response:
{
"data": {
"id": 41,
"documentId": "abc123xyz",
"sessionId": "sess_m5k2h_8a3b1c2d_f9e8d7c6",
"ipAddress": "192.168.1.100",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36...",
"loginTime": "2026-01-02T10:30:00.000Z",
"lastActive": "2026-01-02T13:45:00.000Z",
"logoutTime": null,
"isActive": true,
"deviceType": "desktop",
"browserName": "Chrome 143",
"osName": "macOS 10.15.7",
"geoLocation": null,
"securityScore": null,
"isCurrentSession": true,
"isTrulyActive": true,
"minutesSinceActive": 2
}
}
Terminates only the current session.
POST /api/magic-sessionmanager/logout
Authorization: Bearer <JWT>
Response:
{
"message": "Logged out successfully"
}
Terminates ALL sessions for the authenticated user (logs out everywhere).
POST /api/magic-sessionmanager/logout-all
Authorization: Bearer <JWT>
Response:
{
"message": "Logged out from all devices successfully"
}
Terminates a specific session (not the current one). Useful for "Log out other devices".
DELETE /api/magic-sessionmanager/my-sessions/:sessionId
Authorization: Bearer <JWT>
Response:
{
"message": "Session abc123xyz terminated successfully",
"success": true
}
Error (trying to terminate current session):
{
"error": {
"status": 400,
"message": "Cannot terminate current session. Use /logout instead."
}
}
These endpoints require admin authentication.
GET /magic-sessionmanager/sessions
GET /magic-sessionmanager/sessions/active
POST /magic-sessionmanager/sessions/:sessionId/terminate
POST /magic-sessionmanager/user/:userId/terminate-all
POST /magic-sessionmanager/user/:userId/toggle-block
POST /magic-sessionmanager/sessions/clean-inactive
In config/plugins.ts:
'magic-sessionmanager': {
config: {
// How often to update "last seen" (in milliseconds)
lastSeenRateLimit: 30000, // Default: 30 seconds
// When to mark sessions inactive (in milliseconds)
inactivityTimeout: 900000, // Default: 15 minutes
},
}
In Admin Panel (Settings Tab):
Fix:
config/plugins.tsnpm run buildFix:
Fix:
Fix:
magic_sessions table (not sessions)Perfect for:
Not needed if:
1. Login:
POST http://localhost:1337/api/auth/local
Body: { "identifier": "user@test.com", "password": "pass123" }
2. Check session created:
GET http://localhost:1337/magic-sessionmanager/sessions
3. Logout:
POST http://localhost:1337/api/auth/logout
Authorization: Bearer YOUR_JWT_TOKEN
Done!
When you install this plugin, you get:
Premium features require a license (free to generate):
Q: Do I need to change my Strapi code?
A: No! Just install and enable the plugin.
Q: Will this break my existing logins?
A: No! It just tracks them, doesn't change them.
Q: Can users see each other's sessions?
A: No! Only admins can see all sessions. Users only see their own.
Q: What if I uninstall the plugin?
A: Sessions will stop being tracked. Everything else works normally.
Q: Does it slow down my app?
A: No! It has smart rate-limiting to prevent database spam.
Q: Can I customize the dashboard?
A: Not yet, but it's planned for future versions!
MIT License - Free to use for personal and commercial projects!
Copyright © 2025 Schero D.
This plugin is free and open source, BUT:
⚠️ You CANNOT modify the license validation system
This means:
license-guard.jsWhy? The license system ensures:
What you CAN do:
See LICENSE and COPYRIGHT_NOTICE.txt for full terms.
The admin interface is available in 5 languages:
Language automatically follows your Strapi admin interface setting.
Made for Strapi v5
FAQs
Advanced Session Management for Strapi v5 - Track user sessions with IP geolocation, security scoring, and real-time monitoring
We found that strapi-plugin-magic-sessionmanager 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.