ユーザーから認証を取得するために、ここhttp://developers.facebook.com/docs/authentication/devices/に記載されている手順に従おうとしています。次の python スクリプトを実行します。
#!/usr/bin/python3.2
import os
import urllib
import json
data = urllib.parse.urlencode({'type': 'device_code','client_id': 439862919363245,'scope':})
data = data.encode('utf-8')
request = urllib.request.Request("https://graph.facebook.com/oauth/device")
request.add_header("Content-Type","application/json;charset=utf-8")
try:
response = urllib.request.urlopen(request,data)
httpcode = response.getcode()
responseData = response.read()
dataMap = json.loads(responseData.decode())
except Exception as e:
print ("Exception : "+str(e))
if httpcode != 200:
print('Error : code :'+httpcode+', data : '+data)
sys.exit(1)
print("Success : ")
print(dataMap)
次の出力が得られます。
Exception : HTTP Error 400: Bad Request
Success :
{'username': 'hamepal', 'first_name': 'Rakesh', 'last_name': 'Kumar', 'name': 'Rakesh Kumar', 'locale': 'en_GB', 'gender': 'male', 'id': '713371871'}
The output is really strange. According to document I should have received the data similar to as following.
{"code":"64a99b030985f39a93b2608a4713e758","user_code":"E5MV1N","verification_uri":"http://www.facebook.com/device","expires_in":1800,"interval":5}
ここで何か不足していますか?また、ここで指定されているようにリクエストを複製しようとしました http://oauth-device-demo.appspot.com/しかし、成功しませんでした。
私はネット上で検索しようとしましたが、何も機能しませんでした。助けてください。ここでは、どんな種類の助けも大歓迎です。
編集: 例で指定されているのと同じ client_id を使用すると、正常に動作します。ページに掲載された通知によると、彼らはまだ他のデバイスをサポートしていないようです. そして、アプリケーションの認証フローを探す必要があります。