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 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.v4a" )

local accessToken

local function facebookInitListener( event )

    print( "Facebook initialized" )

    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
end

-- Set the "fbinit" listener to be triggered when initialization is complete
facebook.init( facebookInitListener )