Sign In Register

How can we help you today?

Start a new topic

Facebook Auth

Hi all, I'm trying to add a Social Auth to my app. I've followed the Facebook Auth tutorials and I have it connecting when I manually hard code and set access token taken from test user via Facebook Dev Portal. I understand that when integrating Facebook SDK, the token will be supplied via Facebook Connection Request, but integrating Facebook SDK is where I'm having trouble. I can't find instructions anywhere. Im using LUA with Corona SDK. Anyone been through this process already have any tips?

Hi Michael,


I'm afraid we don't. We can look into this for you and maybe get an example together. Our Lua documentation is in the process of getting updated at the minute.


Regards,

Liam

Thanks, Liam. I'm definitely interested. Facebook is just the beginning. I'm aware GameSparks has support for all kinds of third party accounts like Twitter, Twitch and Kongregate. Though, I imagine they're likely using a similar reg request process right?


If I can help with moving this along do drop me a line. I'm keen to find a solution sooner rather than later. I had a look in the Corona forums and there are people asking similar questions but I see GS support are in there already pointing to the tutorial I mentioned above.


Thanks again.

Hi Micheal


You will need to add the Facebook corona plugin to your app.

Once this is set up you can use facebook.getCurrentAccessToken() to get the access token.

In Lua the request is

 

local requestBuilder = gs.getRequestBuilder()

local FBAuthRequest = requestBuilder.createFacebookConnectRequest()
FBAuthRequest:setAccessToken(accessToken)
FBAuthRequest:setDoNotLinkToCurrentPlayer(false)
FBAuthRequest:setErrorOnSwitch(false)
FBAuthRequest:setSwitchIfPossible(true)
FBAuthRequest:setSyncDisplayName(true)
FBAuthRequest:send(function (FBAuthResponse)
	local authToken = FBAuthResponse:getAuthToken()
	local displayName = FBAuthResponse:getDisplayName(); 
        local newPlayer = FBAuthResponse:getNewPlayer(); 
        local scriptData = FBAuthResponse:getScriptData(); 
        local switchSummary = FBAuthResponse:getSwitchSummary(); 
        local userId = FBAuthResponse:getUserId(); 
end)

 

Regards

Katie


1 person likes this
Thanks for this Katie. After a few FB set ups I'm on the right track. Though now I'm getting the following error once authorised on FB: can not deserialize instance of STRING out of START_OBJECT token Do you think this is something I've not set up on the GameSparks side or in my code?

Hi Micheal


Is the FacebookConnectRequest() successful ?

Can you provide a log of the error and request?


Regards

Katie

Login to post a comment