facebook.getCurrentAccessToken()

Type Function
Return value Table
Revision Release 2022.3683
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