The library uses two cookies: a mandatory session cookie and an optional persistent login cookie.
Renaming the session cookie
You can rename the session cookie to avoid conflicts. The name of the persistent login cookie will automatically follow the session cookie name.
Recommended methods (in order):
- Set
session.name in php.ini. - Call
\ini_set('session.name', 'new_name'); before creating the Auth instance. - Call
\session_name('new_name'); before creating the Auth instance.
Note: session.auto_start must be set to 0 in php.ini for these to work.
Setting cookie domain scope
To share authentication state between subdomains (e.g., example.com and www.example.com), set the session.cookie_domain attribute.
Recommended methods:
- Set
session.cookie_domain in php.ini. - Call
\ini_set('session.cookie_domain', 'example.com'); before creating the Auth instance.
Restricting cookie path
To restrict cookies to specific directories, set the session.cookie_path attribute (e.g., /path/to/subfolder). The default is / (root).