Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Session Token in Fuelphp
  • i would like to get session token from fuelphp, so that i can put in the header to all request send from my angularjs app.

    How i get session id? How do i verify it?

    Any help please
  • I gather your angular app doesn't handle cookies?

    You can get the current active session id using \Session::key(). But you have to be careful with this, Fuel updates its sessions in a shutdown event, and it could be that it will rotate the session id. So it's probably safer to manually rotate the session id before fetching the key, to make sure you have the correct id.

    When validating the session, Fuel looks the session id in:
    - a POST variable with the name configured in 'session.post_cookie_name'
    - a COOKIE with the name configured in 'session.cookie_name'
    - an HTTP header with the name configured in 'http_header_name'
    - a GET variable with the name configured in 'session.cookie_name'

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion