When the user tries to login into my iOS app using Facebook Connect's Single Sign-On (SSO), it fails multiple times before letting the user login to the app. This does not occur every time, but occurs the first time the user tries to login using Facebook.
Steps to Reproduce:
Expected Behavior:
(void)fbDidLogin
method should be called which would authenticate within the base app.Actual Behavior:
(void)fbDidNotLogin:(BOOL)cancelled
is called for the first time alone.How Does SSO Work? SSO works based upon a trust relationship set up between an application, known as the service provider, and an identity provider, like OneLogin. This trust relationship is often based upon a certificate that is exchanged between the identity provider and the service provider.
Single sign-on (SSO) is a session and user authentication service that permits a user to use one set of login credentials -- for example, a name and password -- to access multiple applications.
What is SSO? Single Sign-On (SSO) is an authentication process in which a user is provided access to multiple applications and/or websites by using only a single set of login credentials (such as username and password). This prevents the need for the user to log separately into the different applications.
The user signs in only one time, hence the name of the feature (Single Sign-on). For example, if you log in to a Google service such as Gmail, you are automatically authenticated to YouTube, AdSense, Google Analytics, and other Google apps.
A very good start point would be this link. You can now download the new facebook SDK and can integrate this SDK into your iOS app. The link describs step by step solution. NO need to use login delegate methods like fbdidlogin etc.
You can check weather the user is logged in with the help of sessionStateChanged event.
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
if (!error) {
// We have a valid session
NSLog(@"User session found");
}
break;
case FBSessionStateClosed:
NSLog(@"session state closed");
break;
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
[[NSNotificationCenter defaultCenter] postNotificationName:FBSessionStateChangedNotification
object:session];
}
in your view controller you can user following condition to check weather the user is logged in :
if (FBSession.activeSession.isOpen) {
// your code here
}
All is described in the link given.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With