How to fetch Email,User connections from linkedin using oauth2?
Asked Answered
S

2

7

Currently I am working implementing linkedin login for a website. (Following http://www.raymondcamden.com/2013/04/03/ColdFusion-and-OAuth-Part-2-Facebook/ ). I am successfully able to login, but there are issues while fetching user data from linkiedin. While creating an application in LinkedIn, there is no option for getting permission to user network connections and other data. Here is a screenshot.

enter image description here

When I tried to get the user connections using this url

https://api.linkedin.com/v1/people/~/connections?oauth2_access_token=#session.liaccesstoken# I am getting the below error.

enter image description here

When I tried to get the firstname,lastname and email, Its only fetching firstname and lastname but not the email address.

https://api.linkedin.com/v1/people/~:(id,first-name,last-name,maiden-name,email-address)?oauth2_access_token=#variables.accesstoken

enter image description here

Anyone having idea on it, why its not behaving as per the api expectation?

Scrobiculate answered 26/1, 2016 at 20:36 Comment(6)
This is a duplicate of #30241729Rainey
Why is this tagged php?Lovash
Thanks @JustinKominar , Recently linkedin changed its api. Thanks for redirecting me to the correct link. Dan , I tagged it php, because I see php guys do these kind of integration more.Scrobiculate
Well, here if you are tagging php means its related to PHP field but not related to PHP developers..these are 2 different things.Squama
@DeepakKumarPadhy were you successful in getting the email from linked in apiBacteria
@Mr.bean: Yes I had successfully fetched the email id.Scrobiculate
B
1

I have used this APPLE's SWIFT Language Repo for Linkedin Login and User email fetch. It uses WebView Controller for launching linkedIn Login page. Just drag drop the WebViewController in your project simply push the Controller at the time of need . Here is the URL

Bacteria answered 2/5, 2016 at 10:13 Comment(0)
T
0

for fetching the email from linkedIn you need to set the scope in authorizationURL to which you need to add r_emailaddress as

    let responseType = "code
    let redirectURL = "https://com.appcoda.linkedin.oauth/oauth".stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.alphanumericCharacterSet())!
    let state = "linkedin\(Int(NSDate().timeIntervalSince1970))"
    let scope = "r_emailaddress"
    var authorizationURL = "\(authorizationEndPoint)?"
    authorizationURL += "response_type=\(responseType)&"
    authorizationURL += "client_id=\(linkedInKey)&"
    authorizationURL += "redirect_uri=\(redirectURL)&"
    authorizationURL += "state=\(state)&"
    authorizationURL += "scope=\(scope)"
Theiss answered 7/9, 2016 at 10:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.