Forum QuickConnect facebookOAuthConnectPopup for JavaScript API

Discussion and help relating to PlayerIO's QuickConnect feature, including Facebook Connect and Kongregate Connect.

facebookOAuthConnectPopup for JavaScript API

Postby Aram Sargsyan » June 20th, 2018, 2:25 pm

Hi all,
I am changing my game from AS3 to HTML5, and I didn't find facebookOAuthConnect and facebookOAuthConnectPopup in documentation (JavaScript). PlayerIO support Facebook connect for javaScript api , doesn't it?

Thank You!
Aram Sargsyan
Paid Member
 
Posts: 21
Joined: March 25th, 2018, 5:01 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Henrik » June 23rd, 2018, 10:04 am

Those methods are older convenience methods from back when Facebook didn't really have their current authentication procedure.

The only thing you need to authenticate a PlayerIO game with Facebook is an authentication token, so grab one of those for your user and your game anyway, anyhow, and then pass it into Authenticate: https://playerio.com/documentation/serv ... n/facebook

Or, if you're hosting the game on Sitebox, you can just use a template variable to output the access token to the page: https://playerio.com/documentation/serv ... x/facebook
Henrik
.IO
 
Posts: 1805
Joined: January 4th, 2010, 1:53 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Aram Sargsyan » June 23rd, 2018, 11:07 am

I have already found some solution I think. in PlayerIOClient.development.js file I found this method

c.facebookOAuthConnect = function(gameId, accessToken, partnerId, playerInsightSegments, clientAPI, clientInfo, successCallback, errorCallback, converter){this.call(418, {gameid:gameId, accesstoken:accessToken, partnerid:partnerId, playerinsightsegments:playerInsightSegments, clientapi:clientAPI, clientinfo:clientInfo}, successCallback, errorCallback, converter)}


I used it this way and it is giving everything I need :)
Here is my code

var _client;
var _gameFS;
function facebookConnect(gameId, token, successCallback, errorCallback) {
var channel = new _pio.channel();
channel.facebookOAuthConnect(gameId, token, null, null, "javascript", null, function (result) {
channel.token = result.token;
_client = new _pio.client(channel, gameId, result.gamefsredirectmap, result.userid);
_gameFS = new _pio.gameFS(gameId);
successCallback.apply(this,[_client, _gameFS]);
// return successCallback;
}, errorCallback)
}

Should I keep using this way?

Thank You
Aram Sargsyan
Paid Member
 
Posts: 21
Joined: March 25th, 2018, 5:01 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Henrik » June 23rd, 2018, 12:26 pm

No, use Authenticate, like this:

Code: Select all
PlayerIO.authenticate(gameId, 'public', { accessToken: token }, null,
    function(client) {
        //Here's your correctly initialized and authenticated client
    }, function(error) {
        //Error...
    }
);
Henrik
.IO
 
Posts: 1805
Joined: January 4th, 2010, 1:53 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Aram Sargsyan » June 23rd, 2018, 1:29 pm

Ok will try it :)
Thank you very much!
Aram Sargsyan
Paid Member
 
Posts: 21
Joined: March 25th, 2018, 5:01 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Aram Sargsyan » October 6th, 2018, 7:13 pm

Hi again,

I am trying to deploy html 5 code of FB game to live which is currently FLASH as3 content. As as3 connects to playerIO with facebookOAuthConnect (but html 5 code connects with PlayerIO.authenticate), I get some error from DB

No error callback specified for: GeneralError: Error decoding response from webservice: SyntaxError: Unexpected token N in JSON at position 325
Error
at _pio.channel.call (https://playerio-a.akamaihd.net/gummy-a ... .js:107:17)
at _pio.channel.b.loadMatchingObjects (https://playerio-a.akamaihd.net/gummy-a ... .js:478:14)
at _pio.bigDB.loadSingle (https://playerio-a.akamaihd.net/gummy-a ... js:1203:15)
at PlayerIOController.initUserTable (https://playerio-a.akamaihd.net/gummy-a ... :170991:28)
at PlayerIOController.myUserInfoLoadCallback (https://playerio-a.akamaihd.net/gummy-a ... :170895:14)
at https://gummy-animals-cylwtlq0emz8px6na ... ls/:296:33
at https://playerio-a.akamaihd.net/gummy-a ... l.js:25:17
at a.__wrapper.a.__wrapper (https://connect.facebook.net/en/sdk.js:110:737)
at D (https://connect.facebook.net/en/sdk.js:125:1283)
at Object.b.onload (https://connect.facebook.net/en/sdk.js:121:966)


Thank You
Aram Sargsyan
Paid Member
 
Posts: 21
Joined: March 25th, 2018, 5:01 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Henrik » October 9th, 2018, 12:31 am

Hey,

So what are you trying to do exactly when you get this error?

Load a single BigDB Object?

If so, which table and which key?
Henrik
.IO
 
Posts: 1805
Joined: January 4th, 2010, 1:53 pm

Re: facebookOAuthConnectPopup for JavaScript API

Postby Aram Sargsyan » October 10th, 2018, 10:23 pm

Any table UsersData, PlayersObject ... , i am trying to load by userId like I dis for 3 years but seems like it doesnt work because the data has been created with fb connect method, and now it’s just connect method
Aram Sargsyan
Paid Member
 
Posts: 21
Joined: March 25th, 2018, 5:01 pm


Return to QuickConnect



cron