Automatically refresh OAuth2 token when it has expired

If `OAuth2Credentials.authorize()` had been used, it would have replaced the `request` with `new_request` which checks for token expiry by comparing the HTTP status codes, and called `refresh` when needed to get a new `access_token`.

This fix checks for token expiry based on the expiry time, and calls `refresh` if necessary.