2016-09-25 6 views
0

Facebook GraphAPIでは、Python SDKを使用して、ユーザーに通知を送信しようとしています。私は、エラーメッセージが表示されます。GraphAPIError:現在のユーザーに関する情報を照会するためにアクティブなアクセストークンを使用する必要があります

GraphAPIError: An active access token must be used to query information about the current user 

私のPythonコードは次のとおりです。

graph = facebook.GraphAPI(access_token=TOKENS["app_token"]) 
graph.put_object(parent_object='me', connection_name='notifications', template='Tell us how you like the app!', href='https://www.google.com') 
+1

あなたはアプリのアクセストークンと '/ me'を使用することはできません。アプリスコープのユーザーIDを使用する必要があります。 – CBroe

答えて

0

はソリューション:

graph = facebook.GraphAPI(access_token=TOKENS["user_token"]) 
user_info= graph.get_object(id='me', fields='id') 
graph = facebook.GraphAPI(access_token=TOKENS["app_token"]) 
graph.put_object(parent_object= user_info['id'], connection_name='notifications', template='Tell us how you like the app!', href='https://www.google.com') 
関連する問題

 関連する問題