The WordPress auth cookie is not retained when switching between HTTP and HTTPS. If you have a situation where an HTTP page is making a request to an HTTPS resource then issues will occur.

Here's a relevant article in the WordPress forums:

https://wordpress.org/support/topic/http-and-https-differences-for-function-is_user_logged_in-in-wordpress-40