This guide will help you understand why session cookies expire and how to prevent and resolve these issues.
⚠️ If a session cookie becomes invalid, your Phantom or Flow will display an "Expired session cookie" or "Invalid cookie" error message.
Why are my session cookies expiring and how to resolve it?
Session cookies expire for various reasons, disrupting your automations.
Here are the most common reasons session cookies expire and how to prevent them:
Logged out or session expiration errors
💡Avoid logging out from the social media account while running PhantomBuster automations on them.
The most common reason why session cookies expire is logging out of websites, i.e. LinkedIn. This action ends the session and invalidates the cookie.
This will happen when you either log out manually or are logged out automatically after a set period of time, i.e when your browser session expires.
How to fix "Expired session cookie" error
Avoid logging out of your social media account while running PhantomBuster automations on them.
If you are automatically logged out, the only way to fix the error is to log back in and update the session cookies for the impacted Phantoms and Flows.
Non-compliant with social media limits
⚠️ Social media platforms have strict policies against automation. Gradually automate your actions and avoid exceeding the platform's engagement limits to prevent being flagged or restricted.
💡 Follow the recommended automation rate limits for your Phantoms to avoid being flagged as this will have your session cookie expire and get your account flagged by the social media platform.
Exceeding the rate limits set by a website can lead to your account being warned or restricted and your session cookie to expire as a security measure.
The rate limits vary based on the social media platform and how active your account is.
For example, some of the most common reasons why LinkedIn sends a warning or puts a temporary ban on your account include:
- Using automation tools
- Exceeding account limitations
- Having too many pending connection requests
- Having too many people mark you as someone they don't know
- Breaking other LinkedIn policies around content, identity, and profiles
How to stay compliant while automating on social media
Social media platform algorithms can easily spot unusual activity based on your actions and how other users interact with your content.
For example, this means that you can't go from sending 5 to 500 connection requests in one day on LinkedIn. Instead, slowly build up your account activities to mimic real human behavior.
When setting up Phantoms and Flows, adjust the Behavior of each automation to not exceed recommended limits.
Strict security policies and multiple login locations
⚠️ Multiple sessions occur when you log into the same account from different locations or devices simultaneously.
For example, if you log into Facebook manually from France while a Phantom logs in on your behalf from the USA, Facebook might flag this as unusual activity and end your session in the USA. This will expire your session cookie.
Social media platforms have strict security rules that trigger forced account log out, making your session cookie expire.
To avoid fraud and spam, they track where you log in from and what IP address you use. You can physically only be in one place at the same time.
When you log into the same account from different devices or locations, your cookies might expire on your unused session as a safety measure.
How to keep your session cookie active on multiple locations
💡 Use the same device and location for logging in, or use proxies to manage multiple sessions without causing conflicts.
There are several ways to prevent your session cookies from expiring and causing your Phantoms to stop working.
- Regularly update your session cookies by logging into your account. This will generate a fresh cookie session that you can use to update your Phantoms.
- Use the same device and location when logging in to avoid multiple login locations flags.
- Use proxies to manage multiple sessions, in different locations without causing conflicts.
Server-side session cookie expiration
Some websites have server-side settings that automatically expire session cookies after a certain period. This can cause your session cookie to expire even if you haven't logged out or exceeded rate limits.
How to refresh your session after server-side expiration
If you were automatically logged out, the only way to fix the error is to log back in to your social media account to get a new session cookie and update it in your Phantom’s setup.
Related guides
How to Find and Use Session Cookies
Rate Limit Guidelines for Social Network Automation
Set Up a Proxy: When And Why You Should Use One
You can contact Support at any time for additional details on your PhantomBuster workspace.