帮助通过 LinkedIn 的 API 检索您的个人资料?
我想在我的个人网站上显示我的 linkedin 个人资料中的一些关键字段。根据我对 linkedin API 的理解,我需要执行以下操作:
- 设置开发者帐户并创建开发者帐户。获取 api 密钥和秘密
- 使用密钥和秘密,通过 OAuth 身份验证并获取我自己帐户的访问令牌
- 一旦我拥有访问令牌,我就可以查询配置文件 api 的相关字段
什么是简单的方法获取访问令牌?我明白,一旦获得访问令牌,我就可以随心所欲地使用它,除非我通过我的 linkedin 用户帐户使其过期。我的理解正确吗?
我正在使用 php5,但我认为我的虚拟主机没有编译 PECL OAuth 模块。
I want to display some key fields from my linkedin profile on my personal website. From what I understand of linkedin's API, I would need to do the following:
- Setup a developer account & get the api key and secret
- Using the key and secret, go through the OAuth authentication and obtain an access token for my own account
- Once I have an access token, I can query the profile api for the relevant fields
What would be an easy way of getting the access token? I understand once I get the access token, I can use it for as long as I want unless I expire it via my linkedin user account. Is my understanding correct?
I'm using php5 and I dont think my webhost has PECL OAuth module compiled in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有 linkedin 帐户,请登录开发者网站 http://developer.linkedin.com/index.jspa< /a>
从 https://www.linkedin.com/secure/developer 创建一个新应用程序生成 API 密钥。
入门文档:http://developer.linkedin.com/docs/DOC-1008
JavaScript API http://developer.linkedin.com/docs/DOC-1206
If you have linkedin account then login into the developer site http://developer.linkedin.com/index.jspa
Create a new application from https://www.linkedin.com/secure/developer to generate the API key.
Get started documentation: http://developer.linkedin.com/docs/DOC-1008
JavaScript API http://developer.linkedin.com/docs/DOC-1206
satrun77 在创建新应用程序和获取应用程序密钥方面具有正确的基本工作流程。正如您所提到的,您需要验证您的应用程序;完成后,LinkedIn 将发回您的访问令牌,您可以存储该令牌并在任何后续调用中使用。就您而言,您只是为自己做这件事,但基本前提适用于任何用户。
如果您想在不使用 PECL OAuth 扩展的情况下通过 PHP 连接到 API,有一个专门用于此目的的开源库,以及一个显示可用于入门的基本功能的演示脚本:
http://code.google.com/p/simple-linkedinphp/
satrun77 has the basic workflow correct in terms of creating a new application and getting your application keys. As you mentioned, you then need to authenticate your application; once you have done that LinkedIn will send back your access token, which you can then store and use on any subsequent calls. In your case, you would be just doing this for yourself, but the basic premise would work for any user.
If you want to connect to the API via PHP without the PECL OAuth extension, there is an open-source library specifically for that, along with a demo script showing basic functionality that you can use to get started:
http://code.google.com/p/simple-linkedinphp/