![](/img/trans.png)
[英]Python-social-auth pipeline returns TypeError when I'm trying to get access_token
[英]python social auth get access_token not work in Flask
我嘗試以這種方式獲取用戶的access_token:
social = g.user.social_auth.get(provider='twitter')
token = social.extra_data['access_token']
但出現錯誤
TypeError: get() got an unexpected keyword argument 'provider'
我使用Flask == 0.10.1和python-social-auth == 0.2.1(不希望進行更新)。
請幫助我在flask應用程序中接收用戶的access_token。
從查看文檔開始,嘗試將.get更改為.filter
social = g.user.social_auth.filter(provider='twitter')
g.user.social_auth是一個SQLAlchemy對象,因此您需要將其視為此類。 @juzten很近。 請嘗試以下操作:
社交= g.user.social_auth.filter_by(provider ='twitter')。first()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.