-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fuel_csrf_token() wont generate token. #2020
Comments
You upgraded your PHP version, and short tags are now disabled? It still works fine here:
|
It generates the js function . But it seems to fall out after |
If you get -1 there, the csrf cookie does not exist. Are you changing the name of the cookie in your app after the Security class is loaded? |
please take a look at this VIDEO |
For the audience: you downloaded the framework, added the call to the welcome controller, and then discovered it doesn't work. Rightly so, because as I wrote before, the cookie needs to exist before this will work. And you have done nothing yet to create the cookie. The cookie is only created when you call |
In other words: Try this:
|
Is there any reason why it worked before (like it use to generate token without the |
I wouldn't know, it has always worked like this. DId you have Obviously, in any app, the first page with a form (and a csrf token) would create the cookie, and the cookie would exist until you close the browser, also on pages that don't have a token. Also check the value of |
This may have caused a change in behaviour, in case you have a config file that doesn't include the |
@Ghostff any more feedback on this topic? |
nah, it just works well adding |
With the same codebase? Or with a pre-1.8 version of Fuel that had autoload enabled by default? |
i switch to a new pc, and installed fuel 1.8.0, it generates a token by itself (didnt include |
Logins are not controlled by the CSRF token, so I can't see the connection between the two. How do you install "1.8.0"? And do you run a |
like i validate CSFR before login more like |
As soon as you validate a token, the token will expire. If your ajax page doesn't load a new token, any other form post will post using an invalid token. |
i just post the form once, and its logs me in. but after multiple(2) page refresh, i get logged out. question is why is it passing the |
I am clueless as to what you are talking about. You refresh the post page (i.e. you post the login again)? If you do so, and you have no mechanism in place to update the token in the form, you post the form again with an invalid token, see my previous remark. If you use the Auth package, the login status is recorded in the session, and is not related to CRSF tokens at all. There can be all sorts of reasons for losing the session, but since it's an ajax app, I'd start with checking if the session cookie is updated on the client. If not, you lose the session when the session token rotates server side (by default every 300 seconds). |
like if i login it takes me to account.page but when i refresh the account.page it logs me out. |
So, did you do what I asked and checked if your session mechanism works? |
am not sure if doing it right i have a token of (length=570) after login (length=698) on account.page refresh (length=570)(when i get logged out) |
what kind of session storage do you use? the cookie itself? It looks like you're losing the session for some reason. Time settings on the server ok? |
This use to wok before but all of a sudden it stopped. I downloaded a new one and added this:
to the views > welcome > index.php the
fuel_csrf_token
it created thefuel_csrf_token
function and that's it.The text was updated successfully, but these errors were encountered: