Check first if refresh_token is necessary before throwing exception.
Check first if refresh_token is necessary before throwing exception.

For example if the access_token has no expiration time,
then there is no need of ever refreshing it (which is correctly detected
by getNeedsTokenRefresh()).
Rearranging the order of these two checks solves this issue.

openid/AppAuth-Android