1. AngularJS $http and cookies

    Using AngularJS and trying to set a cookie on the back-end?

    1. Add withCredentials: true config param.

    2. Set Access-Control-Allow-Credentials header to true.

    3. Specify Access-Control-Allow-Origin header on the server. It can only be set to one value for CORS requests, so if you want to allow many sources, you should get the Origin request header, compare it to the array of your desired sources (see appendix), and, if it’s found there, set the …-Allow-Origin header to match your origin.

    4. When setting the cookie, mark httponly as true.

    5. Don’t set the cookie’s domain on localhost.

    Appendix: Working on localhost? Remember that ports are important too.

    Update 1: You can set withCredentials to true as default by injecting $httpProvider in your module's run function: $httpProvider.defaults.withCredentials = true;

  2. berunov:
“ I’ve seen a lot of stories about redemption, none of them end well.
”

    berunov:

    I’ve seen a lot of stories about redemption, none of them end well.

  3. berunov:
“ I don’t ear any heartbeats, only the sound of the Outsider trollin’
”

    berunov:

    I don’t ear any heartbeats, only the sound of the Outsider trollin’

  4. whoisdeshmund:

  5. berunov:
“ Rider!AC ToKW AU Haytham
Maybe I should head to bed.
”

    berunov:

    Rider!AC ToKW AU Haytham
    Maybe I should head to bed.

  6. berunov:
“ Yup, this is Eziiioooooo.
”

    berunov:

    Yup, this is Eziiioooooo.

  7. wicnet:

    Game of Thrones: Season 4: On the Set

  8. annaxin:
“ blood’s scent
”
i love it!

    annaxin:

    blood’s scent

    i love it!

  9. berunov:
“ Assassin!Haytham… voilà !
”

    berunov:

    Assassin!Haytham… voilà !