API access token expiration

Just save the timestamp when the token is running out. Before every request just check if the expiresdate < current_date, if yes just logging again and save the new token.