Add token expiration test
Refactor OAuth2 code