IOS SDK Setup
Ariana.luna (Talk | contribs) (→Get your SocialID data) |
Dirceu.tiegs (Talk | contribs) |
||
Line 73: | Line 73: | ||
* clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials) | * clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials) | ||
* serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials) | * serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials) | ||
+ | |||
+ | And you will need to add three more items to make LinkedIn login work: | ||
+ | |||
+ | * LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app | ||
+ | * LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app | ||
+ | * LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app | ||
= New Project = | = New Project = | ||
Line 105: | Line 111: | ||
Fill in the variables in the following code found in SocialIDSampleAppDelegate.m: | Fill in the variables in the following code found in SocialIDSampleAppDelegate.m: | ||
− | [SocialID setApplicationId: | + | [SocialID setApplicationId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]; |
− | [SocialID setMarketingAccountId: | + | [SocialID setMarketingAccountId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]; |
== Modify Info.plist == | == Modify Info.plist == | ||
Line 120: | Line 126: | ||
* clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials) | * clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials) | ||
* serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials) | * serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials) | ||
+ | |||
+ | And you will need to add three more items to make LinkedIn login work: | ||
+ | |||
+ | * LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app | ||
+ | * LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app | ||
+ | * LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app |
Revision as of 19:45, 28 November 2014
Contents |
Existing Project
Download the SDK
Extract the zip file's contents and drag & drop the SocialID.framework file to the "Frameworks" folder in your XCode project.
Setup FacebookSDK (if you didn't already)
Follow the instructions here.
Setup GoogleSDK (if you didn't already)
Follow the instructions here. It is important to follow the instructions to the letter (set up all required frameworks, set -ObjC under "Other Linker Flags", etc.).
Get your Social-ID data
You will need 4 variables to configure the SDK:
- applicationId: Set up a Social-Id LoginApp at: https://app.socialidnow.com/marketing/login/apps. Your key is the id of the app.
- applicationSecret: The secret can be found on the Call the API menu - https://app.socialidnow.com/marketing/login/apps/APP_ID/apis.
- marketingAccountId: This can be found at: https://app.socialidnow.com/marketing/apis.
- marketingAccountSecret: This can be found at: https://app.socialidnow.com/marketing/apis.
Add the SDK to your app
Add the following statement to your ViewController:
#import <SocialID/SocialID.h>
Add the following code to your app delegate header file:
#import <GooglePlus/GooglePlus.h>
... and make it implement the <GPPSignInDelegate> protocol. For example:
@interface SocialIDSampleAppDelegate : UIResponder <UIApplicationDelegate, GPPSignInDelegate>
Add the following code to the (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method in your app delegate implementation file:
// Initialize SocialID SDK (use the data you collected in the "Get your SocialID data" step) [SocialID setApplicationId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]; [SocialID setMarketingAccountId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]; [SIDFacebook initializeFacebook]; [SIDGoogle initializeGoogle]; [SIDGoogle setDelegate:self];
Add the following methods to your app delegate implementation file:
- (void) finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) error { [SIDGoogle finishedWithAuth:auth error:error]; }
- (BOOL) application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation { return [SIDGoogle application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; }
Modify Info.plist
If you followed the first steps correctly, you should already have the following data in your app Info.plist file:
- FacebookAppID
- FacebookDisplayName
- clientID
You will need to add two more items to make Google+ login work:
- clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials)
- serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials)
And you will need to add three more items to make LinkedIn login work:
- LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app
- LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app
- LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app
New Project
Download & unzip the sample project
Open the project in XCode
Unzip the file, open XCode and use File -> Open to find and open the project's folder.
Setup FacebookSDK (if you didn't already)
Follow the instructions here.
Setup GoogleSDK (if you didn't already)
Follow the instructions here. It is important to follow the instructions to the letter (set up all required frameworks, set -ObjC under "Other Linker Flags", etc.).
Get your Social-ID data
You'll need 4 variables to configure the SDK:
- applicationId: Set up an SocialId LoginApp at: https://app.socialidnow.com/marketing/login/apps. Your key is the id of the app.
- applicationSecret: The secret can be found on the Call the API menu - https://app.socialidnow.com/marketing/login/apps/APP_ID/apis.
- marketingAccountId: This can be found at: https://app.socialidnow.com/marketing/apis.
- marketingAccountSecret: This can be found at: https://app.socialidnow.com/marketing/apis.
Initialize the SDK
Fill in the variables in the following code found in SocialIDSampleAppDelegate.m:
[SocialID setApplicationId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]; [SocialID setMarketingAccountId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
Modify Info.plist
If you followed the first steps correctly, you should already have the following data in your app Info.plist file:
- FacebookAppID
- FacebookDisplayName
- clientID
You will need to add two more items to make Google+ login work:
- clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials)
- serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials)
And you will need to add three more items to make LinkedIn login work:
- LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app
- LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app
- LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app