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)
|
return users.get(user_id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def auth(provider, data, resp):
|
def auth(provider, data, oauth_token):
|
||||||
oauth_token = resp.get(User.get_provider_value(provider, 'token_name'))
|
|
||||||
session[provider + "_token"] = (oauth_token, '')
|
|
||||||
field_map = providers.get(provider).get('field_map')
|
field_map = providers.get(provider).get('field_map')
|
||||||
if not field_map:
|
if not field_map:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
|
@ -29,9 +29,11 @@ def callback(provider):
|
||||||
flash('Access denied: %s' % e.message)
|
flash('Access denied: %s' % e.message)
|
||||||
return redirect(next_url)
|
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')
|
profile = User.get_provider_value(provider, 'profile')
|
||||||
data = remote_app.get(profile) if profile else resp
|
data = remote_app.get(profile) if profile else resp
|
||||||
|
|
||||||
User.auth(provider, data, resp)
|
User.auth(provider, data, oauth_token)
|
||||||
|
|
||||||
return redirect(next_url)
|
return redirect(next_url)
|
||||||
|
|
Loading…
Reference in a new issue