Pregunta

I have an app that use facebook log in (the user can also sign in to a website that use the same facebook app). When the user logs in with facebook, I submit his details to my server(website DB) and present a screen that he need to fill more details. When the screen shows, I call my server to check if the user is already signed In and fill the missing detail, I need a Unique ID to check if user exists in the data base.

What is the method I should use to obtain a Unique User Token that doesn't change ?
or if there is an another do do that ?

Thanks for the help .

¿Fue útil?

Solución

Once you've logged in to Facebook, you can use the Facebook user ID as a unique user token. To do so using the Facebook iOS SDK, you would do something like:

// Get the logged-in user's profile
FBRequest *me = [FBRequest requestForMe];
[me startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *my, NSError *error) {

    if (!error) {
        // Use the logged-in user's Facebook ID as your unique token.
        NSString *uniqueToken = my.id;
    }

}];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top