Tuesday, August 2, 2011

How to disable Facebook Single Sign On (SSO)


Single Sign On is the desirable feature in almost all applications supporting Facebook.
However, if you tend to a scenario where you do not want this SSO feature, you can
omit the feature in a simple single step without removing any of your code during 
implementation of SSO.

To get away from SSO open Facebook.m file and replace method

- (void)authorize:(NSArray *)permissions
         delegate:(id<FBSessionDelegate>)delegate {

  [_permissions release];
  _permissions = [permissions retain];

  _sessionDelegate = delegate;

  [self authorizeWithFBAppAuth:YES safariAuth:YES];
}

with

- (void)authorize:(NSArray *)permissions
         delegate:(id<FBSessionDelegate>)delegate {

  [_permissions release];
  _permissions = [permissions retain];

  _sessionDelegate = delegate;
    [self authorizeWithFBAppAuth:NO safariAuth:NO];
}

In SSO implementation the method "authorizeWithFBAppAuth" takes parameter as "YES", which indicates Facebook to whether authorize from native Facebook application or from native Safari application.
Supplying the parameter  as "NO" signifies not to open any other application for user authentication. And the application shows its authentication dialogue within application.

Thats all you need to do, and the Facebook authentication dialogue opens within your application.

1 comment: