Improvements to refreshing access tokens.
Corrects base url.