是否有任何簡單且完整的配置django-social-auth(https://github.com/omab/django-social-auth.git)的方式?文檔是如此不完整。模板不見了,所有的url都有哪些?如何設置django-social-auth進行網站身份驗證
0
A
回答
2
首先,你必須在用戶點擊,在args你把回調的URL產生解網址:
token = request.GET.get('code')
args = {
'client_id': settings.FACEBOOK_APP_ID,
'client_secret': settings.FACEBOOK_APP_SECRET,
'redirect_uri': request.build_absolute_uri('/authentication_callback'),
'code': token,
}
# Get a legit access token
target = urllib.urlopen('https://graph.facebook.com/oauth/access_token?' + urllib.urlencode(args)).read()
response = cgi.parse_qs(target)
access_token = response['access_token'][-1]
# Read the user's profile information
fb_profile = urllib.urlopen('https://graph.facebook.com/me?access_token=%s' % access_token)
fb_profile = json.load(fb_profile)
# These is the info of the facebook account:
first=fb_profile['first_name']
last=fb_profile['last_name']
email=fb_profile['email']
fb_id=fb_profile['id']
希望這有助於
:
args = {
'client_id': settings.FACEBOOK_APP_ID,
'scope': settings.FACEBOOK_SCOPE,
'redirect_uri': request.build_absolute_uri('/authentication_callback'),
}
HttpResponseRedirect('https://www.facebook.com/dialog/oauth?' + urllib.urlencode(args)
回調的代碼
+0
雖然這是關於FB身份驗證的可靠信息與配置django-social-auth無關。 –
+0
你說得對,我只是在建議一個解決辦法。 – andrebola
相關問題
- 1. 網站身份驗證
- 2. 網站間通信:如何通過網站A與網站B進行身份驗證的用戶進行身份驗證?
- 3. 如何設置Plone 4使用LDAP進行身份驗證?
- 4. 網站窗體身份驗證 - > SQL Server Windows身份驗證
- 5. 如何進行websocket身份驗證?
- 6. 如何進行身份驗證在
- 7. 爲網站設置雙向SSL身份驗證
- 8. 外部網站使用Drupal 7進行身份驗證
- 9. IIS 6突然需要在網站上進行身份驗證
- 10. PhoneGap - 對遠程網站進行身份驗證的方法?
- 11. Google腳本在外部網站上進行身份驗證
- 12. 如何爲WCF REST C#站點設置oAuth身份驗證
- 13. 用asp.net進行Azure AD身份驗證身份驗證
- 14. Authlogic - 通過基本HTTP身份驗證進行身份驗證
- 15. Zend LDAP身份驗證 - 如何設置身份和getIdentity
- 16. 如何設置asp.net mvc身份的自定義身份驗證?
- 17. 如何使用Oracle身份管理器進行身份驗證?
- 18. 如何使用摘要身份驗證手動進行身份驗證?
- 19. 一個網站的SMS身份驗證
- 20. ASP.NET網站身份驗證Cookie共享
- 21. html5網站的身份驗證
- 22. wordpress網站上的Firebase身份驗證
- 23. Azure網站身份驗證/授權
- 24. 繞過網站身份驗證
- 25. 身份驗證和登錄2網站
- 26. 原生WebApp(Webview加載網站)在移動設備上進行身份驗證
- 27. 如何使用Apache HttpClient 4.2.1或>對網站進行身份驗證?
- 28. 如何獲得兩個網站對Thinktecture的Identity Server進行身份驗證?
- 29. 如何登錄到由google + API使用python進行身份驗證的網站?
- 30. 如何使用Samba4中的用戶對PHP網站進行身份驗證AD
有一個示例項目顯示了要設置的內容。你有哪些麻煩? https://github.com/omab/django-social-auth/tree/master/example –
我花了5個小時才真正理解文檔,但我的應用程序現在工作正常。感謝 –