code: def refresh_oauth_credential(self):
          
          if self.session.token_type == auth.SERVER_TOKEN_TYPE:
              return
  
          credential = self.session.oauth2credential
          if credential.is_stale():
              refresh_session = refresh_access_token(credential)
              self.session = refresh_session
docs: Refresh session's OAuth 2.0 credentials if they are stale.