Search code examples
iosswiftfacebook-ios-sdk

Facebook IOS SDK : how to do silent sign in?


I have an app doing a facebook login, which works well, but everytime I reopen it I have to connect again to facebook to do the sign-in. I'm also using google sign-in sdk where I can call the function gSignIn.signInSilently(), is there something similar for facebook? I found this for the javascript sdk but I don't know if it's possible for the ios SDK and how to use it in swift...


Solution

  • The Facebook SDK automatically maintains the login state, which can be confirmed by checking for the access token.

    You can check for the access using the following method:

    FBSDKAccessToken.currentAccessToken()
    

    You can check for the presence of the token which would mean that the user is logged in.

    Check the docs for more details.