访问令牌LinkedIn API [英] access token LinkedIn API

查看:77
本文介绍了访问令牌LinkedIn API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于学校项目,我需要访问LinkedIn API.我已经在LinkedIn Developers上创建了一个应用程序.但是,当我对 https://www.linkedin.com/oauth/v2进行GET请求时/authorization ,我无法获取访问令牌,并且收到您需要传递范围"即使文档指定范围字段是可选的,我还是在请求结束时添加了scope = scope = r_liteprofile%20r_emailaddress%20w_member_social,但出现了无效的范围错误".至于重定向uri字段,我不确定该放什么(我可以放一个随机的网站URL吗?)

For a school project I need access to LinkedIn API. I have already created an app on LinkedIn Developers. However, when I do a GET request to https://www.linkedin.com/oauth/v2/authorization, I am not able to get an access token, and I get "you need to pass the scope" Even though the documentation specified that the scope field is optional, I added scope=scope=r_liteprofile%20r_emailaddress%20w_member_social at the end of my request and got a "invalid scope error". As for the redirect uri field, I am not sure what to put (can I put a random website URL?)

如果有人知道该问题的解决方案或其他获取访问令牌的方法,我将非常感谢:)谢谢!

If someone knows the solution to that problem or know other ways to get an access token, I would be very grateful :) Thank you !

推荐答案

您需要提供重定向URI才能获得有效的访问令牌.

You need to provide a redirect URI in order to get a valid access token.

第一步:

https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOURCLIENTID&redirect_uri=https://my.webserver.com

登录并确认LinkedIn将使用code参数将您重定向到提供的重定向URI.下一步是将此代码交换为访问令牌.

Once you login and confirm LinkedIn will redirect you to the provided redirect URI with the code parameter. The next step is to exchange this code for an access token.

第二步:

如果一切正常,LinkedIn将再次重定向到提供的重定向URI,但这一次是使用访问令牌.

If everything is valid LinkedIn will again redirect to the provided redirect URI, but this time with the access token.

希望有帮助.

这篇关于访问令牌LinkedIn API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆