IdentityManager 0.6

IdentityManager 0.6

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



 
Depends on:
Facebook-iOS-SDK= 3.2.1
AFNetworking= 1.2.0
MBProgressHUD= 0.6
 

  • By
  • Rex Sheng

IdentityManager maintains multiple accounts on each oauth platform, bundled with facebook, twitter, linkedin support. But you can register as many OAuth 1.0a services as you can.

This project was inspired by the following projects:

  • AFOAuth1Client
  • TWiOS5ReverseAuthExample
  • RSOAuthEngine
  • SwitchUserSample from FacebookSDK

Requirement

IdentityManager requires FacebookSDK.framework(v3.1.1) and AFNetworking.

Also you'd best using LLVM4.0 and xCode4.5 to compile. If you are having trouble with lower edition, try adding my submodule ObjectiveCLiterals

Getting Start

You can specify a namespace and maximum slots when creating IdentityManager

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    identityManager = [[IdentityManager alloc] initWithPrefix:@"VH" maximumUserSlots:7];
    ...
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [identityManager handleOpenURL:url];
}

To fully work with Facebook, you need to add FacebookAppID and proper URL Types to your info.plist, and register it using

  [identityManager registerSocialSessionsClass:[FacebookSessions class]];

FaceboookSessions will start a new request and get id and name for you, but you can stop the request from being sent by using _SOCIALSESSIONS_FACEBOOK_TOKEN_ONLY_.

For Twitter and LinkedIn, you need to add TwitterAppID and LinkedInAppID using the app_key they give you and add tw[app_key] and li[app_key] as URL Types, and register them using:

// you probably want to add these to your prefix.pch file.
#define TWITTER_SECRET @"xxxxx"
#define LINKEDIN_SECRET @"xxxxx"

  [identityManager registerSocialSessionsClass:[TwitterSessions class]];    
  [identityManager registerSocialSessionsClass:[LinkedInSessions class]];

Finally start registration like this:

  [identityManager authenticateIdentityWithServiceIdentifier:[TwitterSessions socialIdentifier] completion:^(BOOL success) {
      NSLog(@"done!");
  }];