Saty
Saty

Reputation: 2621

Is it normal to ask "you have already authorize " through Facebook SDK

This is just a question, if I log in once with Facebook login using the latest SDK and then I try to log in again, its asking me "you have already authorize app name". Is it normal or Do I have to change something to avoid it.

In my scenario, I made SSO on in Facebook App Setting this does not resolve the issue!!

Whenever my login window shows, I logout the Facebook and clear the access token, first I thought because of this, this is being asked however, I omitted the code and still it is asking!! I can post code if necessary!!!

override func viewDidLoad() {
    super.viewDidLoad()


    fbloginButton.delegate = self
    fbloginButton.readPermissions = ["public_profile", "email", "user_friends"]
    if (FBSDKAccessToken.currentAccessToken() != nil)
    {


        var loginM:FBSDKLoginManager = FBSDKLoginManager()
        loginM.logOut()
        FBSDKAccessToken.setCurrentAccessToken(nil)

    }
    }



 @IBAction  func loginFb(sender:AnyObject)
{



    fbLoginManager.logInWithReadPermissions(["email"], fromViewController: self.presentingViewController, handler: { (result, error) -> Void in
        if (error == nil){
            var fbloginresult : FBSDKLoginManagerLoginResult = result

        }
    })
}

func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
    NSLog("didCompleteWithResult")
    if ((error) != nil)
    {

    }
    else if result.isCancelled {


    }
    else {
        // If you ask for multiple permissions at once, you
        // should check if specific permissions missing
        if result.grantedPermissions.contains("email")
        {
            ///Here I call a function to get data
    }

}

Upvotes: 0

Views: 640

Answers (1)

Justin Hammenga
Justin Hammenga

Reputation: 1091

It's been a while since I've worked with the Facebook SDK, but I think when you logout, you just invalidate your current accessToken and end your session, but it does not deauthorize your app.

So, when you login, you just generate a new accessToken for the FB app that you already authorized. You need to login again (to verify your identity), but you don't need to authorize again, hence it's giving you that message.

There's a Graph API call to revoke permissions, if that is what you are looking for.

And if your question is whether this is "normal". Yes, I'd say that's normal. It's a visual indication that you are at that point connecting again with a previously authorized FB app. Avoiding it might work by not sending any permissions, but you generally don't know if an already authorized user is logging in again, or a completely new user. If the latter logs in without permissions, well, your app wouldn't work as supposed too.

Upvotes: 1

Related Questions