Using wordpress users from outside of wordpress

I am trying to access wordpress functionality from outside of wordpress. From what I've read the snippet below should do the trick, but it doesn't. It alway returns as if I was not logged in when I know for sure that I am.

<?php require_once('/my-blog-path/wp-blog-header.php'); ?>
echo wp_get_current_user()->ID;

Other functions such as WP_Query are working just fine.