def verify_token_sync(self, token): LOG.debug("verify_token") auth = piston_mini_client.auth.OAuthAuthorizer(token["token"], token["token_secret"], token["consumer_key"], token["consumer_secret"]) api = UbuntuSsoAPI(auth=auth) try: res = api.whoami() except: LOG.exception("api.whoami failed") return None return res
def verify_token_sync(self, token): """ Verify that the token is valid Note that this may raise httplib2 exceptions if the server is not reachable """ LOG.debug("verify_token") auth = piston_mini_client.auth.OAuthAuthorizer( token["token"], token["token_secret"], token["consumer_key"], token["consumer_secret"]) api = UbuntuSsoAPI(auth=auth) try: res = api.whoami() except piston_mini_client.failhandlers.APIError as e: LOG.exception("api.whoami failed with APIError: '%s'" % e) return False return len(res) > 0