Checking the token expiry time

Checking if our token has expired.
Writing some unittests to make sure the token expiry logic works as it should.
whitespace cleanup