开发者

LinkedIn API - Verify the user is logged in on server-side

I'm developing a web site which I hope to use both Facebook and LinkedIn for authentication. Integrating Facebook has been fairly straightforward, but LinkedIn has been tripping me up a bit. I want to be able to verify that the user is both a) currently signed in to the social network of their choice and b) my web site is authorized to access their data. If both conditions are met, then the script will serve up the "members only" area, but if both conditions are not met, then it will take them to a generic home page where they can login using Facebook or LinkedIn.

The Facebook PHP SDK has a very clear example of how to verify if the user is both currently logged in and connected to your application. 开发者_StackOverflow中文版 The LinkedIn API, on the other hand, is a bit more elusive. I'd like to be able to take the following steps:

  1. Authorize my application to read my LinkedIn data
  2. Log out of LinkedIn
  3. Reload my application, and not be able to see the user's data.

This works using the Facebook API. However, I cannot seem to figure out how to do it using LinkedIn.

How can I go about solving this problem? Is it even possible to verify on the server side that the user is currently logged in with the LinkedIn API, or am I stuck with figuring out a way to do it with the JSAPI and client-side redirects?


The LinkedIn REST API doesn't work that way. Once the user authorizes your application, you can make calls regardless of whether they're logged into LinkedIn or not. There is no way for you to check this from your server.

Out of curiosity, why do you want to require them to be logged into Facebook and/or LinkedIn to access the members only area? Isn't is sufficient for them to have granted you access?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜