facebook.getCurrentAccessToken()

Type Function
Return value Table
Revision Current Public Release (2018.3326)
Keywords Facebook, access token, token, getCurrentAccessToken
See also facebook.isActive
facebook.login()
facebook.logout()
facebook.*
fbconnect

Overview

This function replaces the deprecated facebook.currentAccessToken property. It returns the access token (in the form of a table of data) used by Facebook to represent the current user.

Gotchas

Syntax

facebook.getCurrentAccessToken()

Return Value

This function returns a table containing the data provided by a Facebook User Access Token:

Example

local facebook = require( "plugin.facebook.v4" )

local accessToken

if ( facebook.isActive ) then
    accessToken = facebook.getCurrentAccessToken()
    if ( accessToken ) then
        native.showAlert( "Facebook user already logged in", "User's access token: " .. accessToken.token )
    else
        facebook.login()
    end
end