Sign In Register

How can we help you today?

Start a new topic
Answered

iOS SDK FacebookConnectRequest and DeviceAuthenticationRequest

Hi,


My game needs to let player login first by DeviceAuthenticationRequest. Then optional link to Facebook account.

1. I currently send DeviceAuthenticationRequest with a fixed device ID to Authenticate every time the SDK is ready (available).

    Do I need to do it every time or only first time right after user installed the app?

2. If I got the Facebook access token from FB SDK, and then send it via FacebookConnectRequest, 

    what should I do when user reopens the app or the network reconnects? Should I send DeviceAuthenticationRequest again? or FacebookConnectRequest? Or GS SDK does all for me?

3. What if Facebook token expired? 


Just a lit bit confused about the whole process.


Thanks,

Jo


Best Answer
Hey Jo,

In your case i assume that there may be users who do not want to connect to FB, right?

So, in this case, i would suggest always checking for a FB connection when GS becomes available (i.e. in the GS.Available delegate).
If none exists, then try a new connection.
If it the connection fails then login with the deviceauthentication (you should set this up to always fails the first time a user logs in, so they always get a fresh GameSparks profile upon first using the app).
Then they have an option to connect via facebook which preforms the FacebookConnectRequest and adds the FB token to their GS profile.
Then, when the user returns to app, the following happens....

  1. GS connects
  2. FB connects
  3. when FB becomes available preform the FacebookConnectRequest with the current token
  4. User is now logged into GS via FB


As for the FB auth token, it is somewhat mysterious as to how long they last. But each time you login to FB on the client SDK it will generate a new token if the previous one has expired, so always use the one the SDK provides and dont store the token locally. It is only with development testing that you have to physically go and get a short-lived token. During a deployed build the SDK gets the token itself, and you'll be okay.


Hope that helps.

Sean

 

1 Comment

Answer
Hey Jo,

In your case i assume that there may be users who do not want to connect to FB, right?

So, in this case, i would suggest always checking for a FB connection when GS becomes available (i.e. in the GS.Available delegate).
If none exists, then try a new connection.
If it the connection fails then login with the deviceauthentication (you should set this up to always fails the first time a user logs in, so they always get a fresh GameSparks profile upon first using the app).
Then they have an option to connect via facebook which preforms the FacebookConnectRequest and adds the FB token to their GS profile.
Then, when the user returns to app, the following happens....

  1. GS connects
  2. FB connects
  3. when FB becomes available preform the FacebookConnectRequest with the current token
  4. User is now logged into GS via FB


As for the FB auth token, it is somewhat mysterious as to how long they last. But each time you login to FB on the client SDK it will generate a new token if the previous one has expired, so always use the one the SDK provides and dont store the token locally. It is only with development testing that you have to physically go and get a short-lived token. During a deployed build the SDK gets the token itself, and you'll be okay.


Hope that helps.

Sean

 

Login to post a comment