I've get CSRF token from url /rest/session/token. After have CSRF token, I can send request (get, post) to API and working fine. But after time, when I send request. It's doesn't work. I'm getting error permission denies. I think maybe CSRF token expire time. So I want know time life of CSRF token. And how to change time life of CSRF token.
This is the same question I had asked myself and I wanted to increase the lifetime to something like 6 hours.
However, the point behind CSRF tokens is that they change frequently so that nobody can try to steal one of those tokens and then use it to make a forged request. Here's the workflow I ended up using in my application:
- Request a CSRF token.
- Use the token to make requests.
- If the request fails because the token has expired, go to step 1.
Hope it helps. Happy coding.