Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSO requiring multiple attempts to login

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:

  1. User should have the latest version of the Facebook iOS app installed on their iPhone.
  2. In multitasking, ensure that the Facebook app and your base app are both closed.
  3. Tap on Connect with Facebook button in your base app.
  4. This opens your Facebook app and redirects back to your base app without any action.

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.
like image 877
Viggnesh Avatar asked Nov 28 '11 23:11

Viggnesh


People also ask

How does SSO flow work?

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.

What is SSO authorization?

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 ISP SSO?

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.

What is SSO example?

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.


1 Answers

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.

like image 182
YogiAR Avatar answered Sep 20 '22 15:09

YogiAR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!