burnash/gspread — pull request #168 by geekman (2014-09-23 15:27:53+00:00)
Title: 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.