Open pmeske opened 8 months ago
I also got this error
I have a somewhat similar error on v2.25.0.
Clicking Logout in the Admin UI throws the same error, showing the "You have been logged out successfully" page but throwing the exact same error on the server console. In Chrome, I can also see it in the Network Inspector. However, the fact is that I don't get logged out at all. If I click the back button, I am still perfectly logged in.
The weird stuff is that the exact same codebase behaves fine on a different machine.
I have a somewhat similar error on v2.25.0.
Clicking Logout in the Admin UI throws the same error, showing the "You have been logged out successfully" page but throwing the exact same error on the server console. In Chrome, I can also see it in the Network Inspector. However, the fact is that I don't get logged out at all. If I click the back button, I am still perfectly logged in.
The weird stuff is that the exact same codebase behaves fine on a different machine.
I am getting the same error as PavelGolodoniuc on v3
@shadow5og, I have actually resolved the issue now. The problem was in the incorrect CORS setting. I fixed it with the following configuration option:
export default buildConfig({
...
cors: HOSTS_WHITELIST,
csrf: HOSTS_WHITELIST,
});
Where:
const HOSTS_WHITELIST = [ "http://localhost:3000", "http://localhost:4200", "https://cms.site.com" ]
Link to reproduction
https://github.com/pmeske/payload/tree/issue/token-expiration
Describe the Bug
When I define a tokenExpiration and wait for the User to get logged out automatically, I always see an Exception in the Server-Logs:
I think the Issue is the timing of the Logout. The User gets logged out when the Token / Cookie is already expired. Therefore there is no User to Logout in the payload\src\auth\operations\logout.ts:29.
To Reproduce
Open the Backend and wait for ~2 Minutes to get logged out automatically. Unfortunally I could not reduce that time to something lower than 2 Minutes, because then the application ends in a kind of infinite loop, always refreshing the current Token.
Payload Version
2.11.2
Adapters and Plugins
No response