Slaus
Slaus

Reputation: 2236

Facebook: obtain user's locale

In Facebook Web Games with FB JS SDK how one obtains user's locale, i.e. language user prefers to speak to render a game with?

Tried these but none of it worked:

    FB.api(
        '/me',
        { fields: 'id,name,first_name,last_name,locale,picture'},
        r => console.log( 'FB /me:', r ),
    )

Prints everything but locale. And:

FB.login( response => console.log( 'locale:', response.authResponse.user.locale ) )

where response.authResponse doesn't have user field at all

Upvotes: 1

Views: 491

Answers (1)

04FS
04FS

Reputation: 5820

locale isn’t available any more, see https://developers.facebook.com/docs/graph-api/changelog/version3.0/#gapi-change:

The following default fields have replaced public_profile: […]

As a result, the following fields that belonged to public_profile are deprecated:
- […]
- locale
- […]

.

where response.authResponse doesn't have user field at all

Not supposed to any more either, you only get a userID, see https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus#response_and_session_objects

Upvotes: 2

Related Questions