Use Device Login on Smart Tv / Console
I Have Noticed That Facebook Seems to Support Device Login with a Token / Pin Code Instead of User/Login to Be Used on Devices Like Tv or Console: in the...
I have noticed that Facebook seems to support Device Login with a token / PIN Code instead of user/login to be used on devices like TV or console:
In the search of the dev page I can see there was an article related to this, but at least in Germany that one gives a 404.
Anyone has more information on this?
Thanks
4 Answers
i've been researching for that too but unfortunately the facebook device auth is still on experimental and they didn't give new keys (partner) to use the device auth.
You can find the working example here: Just look at the website source and you can have the appID that works with it.
The other one is twitter PIN oauth it's working and publicly available (i'm using it)
Facebook login for smarttv/devices without facebook sdk is possible throught code , check the documentation here :
Implement Login for Devices
Facebook Login for Devices is for devices that directly make HTTP calls over the internet. The following are the API calls and responses your device can make.
1. Enable Login for Devices
Change Settings > Advanced > OAuth Settings > Login from Devices to 'Yes'.
2. Generate a Code which is required for facebook device identification
When the person clicks Log in with Facebook, you device should make an HTTP POST to:
POST
type=device_code
&client_id=<YOUR_APP_ID>
&scope=<COMMA_SEPARATED_PERMISSION_NAMES> // e.g.public_profile,user_likes
The response comes in this form:
{
"code": "92a2b2e351f2b0b3503b2de251132f47",
"user_code": "A1NWZ9",
"verification_uri": "",
"expires_in": 420,
"interval": 5
}
This response means:
- Display the string “A1NWZ9” on your device
- Tell the person to go to “ and enter this code
- The code expires in 420 seconds. You should cancel the login flow after that time if you do not receive an access token
- Your device should poll the Device Login API every 5 seconds to see if the authorization has been successful
3. Display the Code
Your device should display the user_code and tell people to visit the verification_uri such as on their PC or smartphone. See the Design Guidelines.
4. Poll for Authorization
Your device should poll the Device Login API to see if the person successfully authorized your application. You should do this at the interval in the response to your call in Step 1, which is every 5 seconds. Your device should poll to:
POST
type=device_token
&client_id=<YOUR_APP_ID>
&code=<LONG_CODE_FROM_STEP_1> //e.g."92a2b2e351f2b0b3503b2de251132f47"
You will get 200 HTTP code i.e User has successfully authorized the device. The device can now use the access_token value to make authenticated API calls.
5. Confirm Successful Login
Your device should display their name and if available, a profile picture until they click Continue. To get the person's name and profile picture, your device should make a standard Graph API call:
GET
fields=name,picture&
access_token=<USER_ACCESS_TOKEN>
Response:
{
"name": "John Doe",
"picture": {
"data": {
"is_silhouette": false,
"url": ""
}
},
"id": "2023462875238472"
}
6. Store Access Tokens
Your device should persist the access token to make other requests to the Graph API.
Device Login access tokens may be valid for up to 60 days but may be invalided in a number of scenarios. For example when a person changes their Facebook password their access token is invalidated.
If the token is invalid, your device should delete the token from its memory. The person using your device needs to perform the Device Login flow again from Step 1 to retrieve a new, valid token.
They change it again. At this moment documentation does not fit actual situation.
Commonly all works as expected with one small difference. Login from Devices config now moves to Products -> Facebook Login.
So you need to:
- get your
App idfrom headline, - get
Client Tokenfrom appSettings -> Advanced. There is alsoNative or desktop app?question/config. I turn it on. - Add product (just click on
Add productand thenGet startedonFacebook login. Move back to your app config, click to newly addedFacebook loginand you'll see yourLogin from Devicesconfig.