Swift 2 OAuth2 LinkedIn connection
Asked Answered
H

3

8

I'm gonna make an native iOS app with Swift 2 and Xcode 7. The users should login using LinkedIn and OAuth 2 but I'm wondering how I should begin to set this up. I don't have many experience with OAuth 2.

Is there a good tutorial or a sample app? I saw the Ray Wenderlich post but that comes with an existing project. I want to build an app with LinkedIn login from scratch.

EDIT

I want to use the LinkedIn login to get the user's connections and send them notifications. I was researching this and I found some pages that said that connections can't be retrieved from the new LinkedIn API, is this true? It is not possible to get someone's connections from LinkedIn in a native iOS applications?

Heliogravure answered 21/9, 2015 at 13:49 Comment(0)
P
7

You should start with LinkedIn guide for LinkedIn and OAuth 2 . But still if you need a sample for Authentication with OAuth 2 here it is .

For your second question related to the connection yes Linked have made changes but the API is still available but for the partners .

If you are an existing LinkedIn partner, these changes will not impact your existing partnership or the associated APIs that your partnership allows you to access.
If you are experiencing issues as a result of the May 12th changes, please reach out to your LinkedIn Business Development representative immediately.

For further details you can see Developer Program Transition Guide.

Punchboard answered 1/10, 2015 at 3:32 Comment(0)
K
1

Check out this repo, I did this swift pre-2.0 but it shows you the basic algorithm. You can do it the with your secret hard coded or fetch it from the server. The key is getting the oath header just right which is a huge pain https://github.com/GregPrice24/SwiftStream

Kattiekatuscha answered 25/9, 2015 at 14:34 Comment(2)
Your repo is totally for Twitter, is it the same thing with LinkedIn? What I understand is that LinkedIn changed their API and reduced the amount of data you can get now. I need the connections of the logged in user but I don't think that is possible anymore.Heliogravure
Technically yes, OAuth flows follow the same specs. However they differ in there callback handling. This is really what you want. These people really got it right github.com/dongri/OAuthSwiftKattiekatuscha
O
1

Check this out: https://github.com/jeyben/IOSLinkedInAPI

I used this repo and successfully implement LinkedIn integration in my App. It is in Objective-C but you can use Cocoapods and import them as Frameworks and use in swift2 with no trouble.

Note: As of the 12´ May 2015 LinkedIn applied restrictions to API usage for all non partners: See: https://developer.linkedin.com/blog/posts/2015/developer-program-changes

So you can only get the basicprofile at the beginning, but you can apply for the partner program to get those extra information such as connections here: https://developer.linkedin.com/partner-programs

Overstreet answered 1/10, 2015 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.