Fix user having to log in after token refresh

Fix get_cached_token method failing to return refreshed tokens, meaning that users have to log in when the token expires. Full explanation in commit message: mattduck@72d13dd.