5

Can I use Javascript to see if an HTTP-only cookie exists, I don't want to see the value, just know whether or not it is there.

I need this because I have an API using cookie based authentication with servicestack, with a client side SPA. I need to know, client side, whether or not I am authenticated.

Is this possible?

JMK
  • 27,273
  • 52
  • 163
  • 280

1 Answers1

8

No.

HTTP-only cookies are not exposed to the JS in any way. That is the point of the HTTP-only flag.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335