def requestAvatarId(self, credentials):
"""
Return the avatar id of the avatar which can be accessed using the
given OAuth credentials.
@param credentials: A L{IOAuthCredentials} that contains OAuth
credentials.
@raise UnauthorizedLogin: if the OAuth credentials don't match the
L{User}'s.
"""
try:
session = yield self.facadeClient.authenticateUserWithOAuth(
credentials)
except TPasswordIncorrect:
logging.info('Bad OAuth credentials: %r:%r' %
(credentials.consumerKey, '<sanitized>'))
raise error.UnauthorizedLogin('Invalid credentials')
except Exception:
logging.info('requestAvatarId exception authenticating %r/%r.' %
(credentials.consumerKey, '<sanitized>'))
raise
else:
defer.returnValue(session)
评论列表
文章目录