Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to tell if a user is logged in from JavaScript

How to tell if a user is logged in from JavaScript

justinGP
Tourist
3 0 3

Hi,

I have some functionality I am trying to build where I see whether or not the current user is authenticated, and fire some events based off that logic. I was planning on using secure_customer_sig to see whether or not it is set, and then firing / not firing those events.

However, I have now learned secure_customer_sig is HttpOnly, so I cannot read it from the client.

I need no customer data, I just want to know if they are authenticated or not. Is there any way to do this from JS?

Thanks!

Reply 1 (1)

michaeltheodore
Explorer
59 6 9

@justinGP how are your users authenticated?

Do they use a web form to sign in with an email, password combo?

Or do they simply visit your store in the browser?