Facebook.access_token issue (iOS)(DEF-3876)

I have the issue, then I am trying to get facebook.access_token after game init.

On android, if I have logged in facebook on previous sessions, all ok. But on iOS I got nil access token

In game I have the next logic: if FB token is not exist, try to login in facebook.
And after this login window is appear, I got the FB token, without any action on this window (even it still open).

Why it can be? I cant get the access token on iOS in next sessions after login without FB login window.

Hmm, we do facebook tests prior to every release and there was no Facebook issue reported in the last release. Can you isolate this down to a single script and share it?

Do you have the facebook app installed on both Android and iOS?

Which iOS version have you tested on?

Yea, I will try make a simple project to show this issue, but after weekend (I will post here with it)
I have no facebook app on Android, and have two devices on iOS: with and without facebook app. iOS version is different, the last one I test (with fb app): 11.4.1

I will gather all info what I can and post update later

1 Like

Up the topic
Meeted the problem again. After login on fb, and reopen game, at start of the game on iOS facebook.access_token() == nil. On android all ok

But on start of the game I want to login on server and I dont want store tokens by myself
I login on iOS with FB app, iOS still 11.4.1

How I can make example project? You can’t build it on iOS due the provisions and identity? Or am I wrong

Can you please share the snippet of code where you interact with Facebook.

This is example to test this issue on Android and iOS. Sorry, that not did it early

Facebook token test.zip (4.4 KB)

In this test you should run app, login to facebook and restart the game

Android output logs:

Start of facebook test iOS issue with access token
Login to facebook game id:	551639031949279
This is id of my application: 551639031949279

Test next issue:
If we already logined into facebook. On android I will have token at game start
But if we playing on iOS devices, access_token will be nil
Check access token in facebook
My access token:	nil
Check token in game save
Dont have facebook data. Please press login

-- Login to Facebook
Success login to facebook. My token:	{MY_CORRECT_TOKEN_HERE}
I will store access token via sys.save to load in in next game start
Now manually close the game and reopen it to test access_token
If I reboot engine with msg.post:reboot, facebook access token on iOS will be exist at start. This is strange

-- Restart the game
Start of facebook test iOS issue with access token
Login to facebook game id:	551639031949279
This is id of my application: 551639031949279

Test next issue:
If we already logined into facebook. On android I will have token at game start
But if we playing on iOS devices, access_token will be nil
Check access token in facebook

-- On Android we have token at stat
My access token:	{MY_CORRECT_TOKEN_HERE}
Check token in game save
I have stored access token in game data
Stored token:	{MY_CORRECT_TOKEN_HERE}

And iOS output logs:

Start of facebook test iOS issue with access token
Login to facebook game id:	551639031949279
This is id of my application: 551639031949279

Test next issue:
If we already logined into facebook. On android I will have token at game start
But if we playing on iOS devices, access_token will be nil
Check access token in facebook
My access token:	nil
Check token in game save

-- From prev. test I have facebook data. How can I clear iOS app data? :)
I have stored access token in game data
Stored token:	{MY_CORRECT_TOKEN_HERE}

-- Login to Facebook
On facebook login event
Success login to facebook. My token:	{MY_CORRECT_TOKEN_HERE}
I will store access token via sys.save to load in in next game start
Now manually close the game and reopen it to test access_token
If I reboot engine with msg.post:reboot, facebook access token on iOS will be exist at start. This is strange

-- Restart the game
Start of facebook test iOS issue with access token
Login to facebook game id:	551639031949279
This is id of my application: 551639031949279

Test next issue:
If we already logined into facebook. On android I will have token at game start
But if we playing on iOS devices, access_token will be nil
Check access token in facebook

-- Dont have token at start at iOS
My access token:	nil
Check token in game save
I have stored access token in game data
Stored token:	{MY_CORRECT_TOKEN_HERE}
1 Like

Thanks. @AGulev, could you please help out with a bit of testing tomorrow?

1 Like

Yes, of course.

2 Likes

It seems like Facebook initialization on iOS takes longer time than on Android. We will check what we be able to do with that: DEF-3876 .
It’s annoying when implementation on different platforms works a different way.

Current workaround:

	timer.delay(1, false, function() 
		print("CHECK TOKEN WITH DELAY:", token)
	end)

Example:
Facebook_token_test.zip (8.3 KB)

1 Like

Or another workaround is storing token and check it at start

Anyway, I will wait any news about it, thanks for investigation:)