Skip to content

A free open source IT asset/license management system

Make the passport cookie name configurable

snipec752c2a12540
diff --git a/.env.example b/.env.example
index 5c0a0b8abc..426af4ff88 100644
--- a/.env.example
+++ b/.env.example
@@ -87,6 +87,7 @@ SESSION_LIFETIME=12000
EXPIRE_ON_CLOSE=false
ENCRYPT=false
COOKIE_NAME=snipeit_session
+PASSPORT_COOKIE_NAME='snipeit_passport_token'
COOKIE_DOMAIN=null
SECURE_COOKIES=false
API_TOKEN_EXPIRATION_YEARS=15
diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php
index f7f9b47a0a..a69a6cadf0 100644
--- a/app/Providers/AuthServiceProvider.php
+++ b/app/Providers/AuthServiceProvider.php
@@ -91,7 +91,7 @@ class AuthServiceProvider extends ServiceProvider
Passport::refreshTokensExpireIn(Carbon::now()->addYears(config('passport.expiration_years')));
Passport::personalAccessTokensExpireIn(Carbon::now()->addYears(config('passport.expiration_years')));
- Passport::cookie('snipeit_token');
+ Passport::cookie(config('passport.cookie_name'));
/**
diff --git a/config/passport.php b/config/passport.php
index d410cfe20e..8de731b49a 100644
--- a/config/passport.php
+++ b/config/passport.php
@@ -14,4 +14,5 @@ return [
'private_key' => env('PASSPORT_PRIVATE_KEY'),
'public_key' => env('PASSPORT_PUBLIC_KEY'),
'expiration_years' => env('API_TOKEN_EXPIRATION_YEARS', 20),
+ 'cookie_name' => env('PASSPORT_COOKIE_NAME', 'snipeit_passport_token'),
];