set token in session before making oauth request
This commit is contained in:
parent
7178a6190e
commit
c3ac176c15
|
@ -111,9 +111,7 @@ class User(BaseUser):
|
|||
return users.get(user_id)
|
||||
|
||||
@staticmethod
|
||||
def auth(provider, data, resp):
|
||||
oauth_token = resp.get(User.get_provider_value(provider, 'token_name'))
|
||||
session[provider + "_token"] = (oauth_token, '')
|
||||
def auth(provider, data, oauth_token):
|
||||
field_map = providers.get(provider).get('field_map')
|
||||
if not field_map:
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -29,9 +29,11 @@ def callback(provider):
|
|||
flash('Access denied: %s' % e.message)
|
||||
return redirect(next_url)
|
||||
|
||||
oauth_token = resp.get(User.get_provider_value(provider, 'token_name'))
|
||||
session[provider + "_token"] = (oauth_token, '')
|
||||
profile = User.get_provider_value(provider, 'profile')
|
||||
data = remote_app.get(profile) if profile else resp
|
||||
|
||||
User.auth(provider, data, resp)
|
||||
User.auth(provider, data, oauth_token)
|
||||
|
||||
return redirect(next_url)
|
||||
|
|
Loading…
Reference in a new issue