From b94978a647dc15701c2f668e28724e92e60b9dd7 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Thu, 15 Mar 2012 13:23:04 -0700 Subject: [PATCH] Fix: add client_id to OAuth2 access tokens. --- r2/r2/controllers/oauth2.py | 2 +- r2/r2/models/token.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/r2/r2/controllers/oauth2.py b/r2/r2/controllers/oauth2.py index a957a6099..e23569106 100644 --- a/r2/r2/controllers/oauth2.py +++ b/r2/r2/controllers/oauth2.py @@ -186,7 +186,7 @@ class OAuth2AccessController(MinimalController): if not c.errors: auth_token = OAuth2AuthorizationCode.use_token(code, c.oauth2_client._id, redirect_uri) if auth_token: - access_token = OAuth2AccessToken._new(auth_token.user_id, auth_token.scope) + access_token = OAuth2AccessToken._new(auth_token.client_id, auth_token.user_id, auth_token.scope) resp["access_token"] = access_token._id resp["token_type"] = access_token.token_type resp["expires_in"] = access_token._ttl diff --git a/r2/r2/models/token.py b/r2/r2/models/token.py index 33baf2823..fb1a3a653 100644 --- a/r2/r2/models/token.py +++ b/r2/r2/models/token.py @@ -276,9 +276,10 @@ class OAuth2AccessToken(Token): _connection_pool = "main" @classmethod - def _new(cls, user_id, scope_list): + def _new(cls, client_id, user_id, scope_list): scope = ','.join(scope_list) return super(OAuth2AccessToken, cls)._new( + client_id=client_id, user_id=user_id, scope=scope)