bannerColor WARNING_YELLOW templateName stackForums

Integrating your OS X Mavericks Application with LinkedIn

Overview

Whether you're new to LinkedIn Platform development or looking to enhance your existing OS X Mavericks application's user experience, our platform makes it easy and straight-forward to leverage the power of professional identity with LinkedIn. Integrating your OS X app with LinkedIn allows you to provide, among other things, single sign on experience and publishing your application's content to the authenticated user's network updates stream. This guide will give you the details to quickly get started with your LinkedIn integration.

Single Sign On Experience

OS X Mavericks provides users with the ability to associate their LinkedIn identity to the device along with a framework to make it simple for your application to leverage it. When your application attempts to access the user's identity in the OS, they'll be presented with a dialog requesting permission to access their LinkedIn account:

image description

Within this dialog is a list of LinkedIn member permissions that your application requests from the user. Once the user allows access to your application, they won't be prompted the dialog again. Details on how to specify member permissions are provided later in the document.

Registration

If you don't already have a LinkedIn API key registered, you'll need to so before integrating your OS X application. We require that you're familiar with our Authentication flow, particularly the concept of granting member permissions to your application. When your application first requests access to the user's LinkedIn account, they'll be presented with a dialog indicating which permissions your application is requesting. Once they've authorized your application, they won't be prompted with the dialog again.

Among the several configuration options you have with your LinkedIn API key, the most critical for your integration is your OS X application's bundle identifier as it allows LinkedIn to identify your application and associate it with your API key. Your application's bundle identifier can be found when you first create your application in Xcode:

You can also view your bundle identifier by navigating to the "General" tab of your application's target:

Once found, you'll need to associate your bundle identifier to your application on your LinkedIn application settings page:

Making Authenticated API Calls to LinkedIn

The Social Framework provided by Apple allows you to easily make authenticated API calls to LinkedIn. With this framework, your application can access the LinkedIn member's account stored on the OS X device. If you haven't already done so, you'll need to add the Social Framework to your application project in Xcode:

image description

For general Xcode and Mac OS X development topics, we encourage you to refer to the official Apple Developer Site. You can also refer to the Social Framework documentation for more detailed reference.

Sample API Request

Once you've added the framework to your project, you can access the LinkedIn member's account and make your first authenticate API call with only a few lines of code. We've provided an Objective-C example to illustrate how to access a member's account and make an API call to fetch their LinkedIn profile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@import <Accounts/Accounts.h>
@import <Social/Social.h>
 
//Member Permission Scopes
NSArray *permissions = @[@"r_network",
                         @"r_fullprofile",
                         @"rw_nus"];
    
// Set up the request
NSDictionary *options = @{ACLinkedInAppIdKey : @"API Key",
                              ACLinkedInPermissionsKey: permissions};
 
ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountType *linkedInAccountType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierLinkedIn];
    
// Request access to LinkedIn account on device
[store requestAccessToAccountsWithType:linkedInAccountType options:options completion:^(BOOL granted, NSError *error) {
        
        if(granted)
        {
                SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeLinkedIn
                                                requestMethod:SLRequestMethodGET
                                                URL:[NSURL URLWithString:@"https://api.linkedin.com/v1/people/~"]
                                                parameters:@{@"format" : @"json"}];
            
                request.account = store.accounts.lastObject;
            
                [request performRequestWithHandler:^(NSData *responseData,
                                                        NSHTTPURLResponse *urlResponse,
                                                        NSError *error) {
                        if (responseData) {
                    
                                //Handle Response
                        }
        }];

Throttle Limits

The API key that you use for your Mac OS X integration follows the same throttle limit rules as any other application on the LinkedIn Platform. These call throttles are provided to protect the user experience of LinkedIn members while also emphasizing API call efficiency for our developers. For more details please refer to our throttle limits documentation.

Additional Questions

If you have any questions related to your integration, please feel free to jump in the developer forums