LinkedIn mobile access token for making server side REST API calls
Asked Answered
S

2

5

As per LinkedIn documentation I see that we cannot use the mobile access token to make REST API calls which LinkedIn provides. I have a use case, where, in my mobile app, I use LinkedIn's mobile SDK for logging in to linkedin and I need to fetch certain data like logged in user's connections etc on the backend. This should ideally be done on backend instead of mobile because I do not want too many calls going from app to our servers. Is there any work around to do this?

Sapienza answered 19/4, 2015 at 9:31 Comment(0)
E
3

Using the Mobile SDK, there's really no way around this at the moment. If you require back-end call capability, your best bet is to use an existing auth library that implements OAuth 2.0 in the mobile environment rather than using the official SDK. That way, the access tokens you get back from the process are usable in either situation.

Elwaine answered 21/4, 2015 at 17:27 Comment(4)
Are there any plans to add this functionality to the mobile SDK? Would be great if we could take advantage of the native authentication instead of requiring the user to re-authenticate via a webview.Gus
It's on the roadmap, but there are no dates to share at this time.Elwaine
You posted above answer on 2015.Now July/2017.Do you have any good news to share with us, please? @JustinKominarUnread
@JustinKominar Using nazlo's answer we can fetch the profile data. We just need to pass 'x-li-src = msdk' params in header and it works. Please update your answer as your post is very old. ThanksDetoxicate
J
10

Actually, there is a way to do requests from backend to linkedin via mobile SDK token.

Such configuration worked for me:


GET https://api.linkedin.com/v1/people/~?format=json
Headers:
Authorization = Bearer ${token}
x-li-src = msdk
Justiceship answered 19/8, 2016 at 6:49 Comment(1)
Purrrrrfect :-DLoppy
E
3

Using the Mobile SDK, there's really no way around this at the moment. If you require back-end call capability, your best bet is to use an existing auth library that implements OAuth 2.0 in the mobile environment rather than using the official SDK. That way, the access tokens you get back from the process are usable in either situation.

Elwaine answered 21/4, 2015 at 17:27 Comment(4)
Are there any plans to add this functionality to the mobile SDK? Would be great if we could take advantage of the native authentication instead of requiring the user to re-authenticate via a webview.Gus
It's on the roadmap, but there are no dates to share at this time.Elwaine
You posted above answer on 2015.Now July/2017.Do you have any good news to share with us, please? @JustinKominarUnread
@JustinKominar Using nazlo's answer we can fetch the profile data. We just need to pass 'x-li-src = msdk' params in header and it works. Please update your answer as your post is very old. ThanksDetoxicate

© 2022 - 2024 — McMap. All rights reserved.