0

私は、クライアントのIDがsome_client_idで、ユーザーはFacebookのoauthで認証されているアプリを持っています。返されるトークン(コード)はsome_token_to_auth_the_userです。django restフレームワークをappidとアクセストークンで認証しますか?

私のバックエンドがdjango rest frameworkであり、rest_authです。

は、今私は、URLを入力する資格情報は、フォームが何であるか http://localhost.com:8000/rest-auth/facebook/ enter image description here

facebook code (token)

でユーザーを認証しようとしていますか?

client-idfacebook-tokenですか?私は両方を試してみました

出力された、私が間違っているの何

TypeError at /rest-auth/facebook/ 
__init__() takes exactly 2 arguments (1 given) 
Request Method: POST 
Request URL: http://localhost.com:8000/rest-auth/facebook/ 
Django Version: 1.9.6 
Exception Type: TypeError 
Exception Value:  
__init__() takes exactly 2 arguments (1 given) 
Exception Location: /home/xo/.virtualenvs/dj19/local/lib/python2.7/site-packages/rest_auth/registration/serializers.py in validate, line 63 
Python Executable: /home/xo/.virtualenvs/dj19/bin/python 
Python Version: 2.7.10 

これらは図であり、

from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter 
from rest_auth.registration.views import SocialLoginView 
from allauth.socialaccount.providers.twitter.views import TwitterOAuthAdapter 
from rest_auth.views import LoginView 
from rest_auth.social_serializers import TwitterLoginSerializer 


class FacebookLogin(SocialLoginView): 
    adapter_class = FacebookOAuth2Adapter 


class TwitterLogin(LoginView): 
    serializer_class = TwitterLoginSerializer 
    adapter_class = TwitterOAuthAdapter 

?何か助けてくれてありがとう。

答えて

0

Facebook SDKはLogin functionを提供しています。

これは、access_tokencodeを持つauthResponseを返します。 Facebookでユーザーを認証するエンドポイントDjango-rest-authにはPOSTが必要です。

関連する問題