生成Linkedin访问令牌 [英] Generating Linkedin Access Token

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

问题描述

我一直在尝试使用简单的REST客户端以及适用于Mozilla的REST插件.我正进入(状态 带有"HTTP/1.1 401未经授权"的响应 正文中的"{{error:" unauthorized_client," error_description:"该客户端未被授权}".

I have been trying with the simple REST Client as well as the REST Plugin for Mozilla. I am getting "HTTP/1.1 401 Unauthorized" response with "{"error":"unauthorized_client","error_description":"the client is not authorized"}" in the body.

我已经成功获取了验证码,以下是对访问令牌的POST请求(范围为r_fullprofile)

I have been successful in getting the auth code, and the below is the POST request for access token, (Scope is r_fullprofile)

https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=AQTQeBxBzbU2aNWaQM6Ff3Z3bUd8Gyg10W9G2DdqXgWiP0q7-M55c5PLtppP7Ni3Y-6A9C8yDkj9K4VfJ7QkRUFjuV-3AknA5jAahpsFJv3wYfr8XD8&redirect_uri=https://www.google.com& client_id = 75wl6j5zndvfkp& client_secret =秘密

redirect_uri = https://www.google.com 也是用于获取身份验证代码的一种

The redirect_uri=https://www.google.com is the one used for getting auth code as well.

在发出POST请求之前,我们是否需要执行任何URL编码?

Do we need to perform any URL encoding before making the POST request?

当我登录链接到我的应用程序时,它具有以下令牌, OAuth用户令牌:c3ae4cee-1b23-xxx-9d2a-206f578dee4d OAuth用户密码:76bc48cc-c94f-xxx-bf9d-a663f7003383

When I log into the linked in to my app, it has the below tokens, OAuth User Token: c3ae4cee-1b23-xxx-9d2a-206f578dee4d OAuth User Secret: 76bc48cc-c94f-xxx-bf9d-a663f7003383

我不确定在哪里使用它.我们正在使用API​​&密钥以获取身份验证代码.

I am not sure where it is used. we are using API & secret key to get auth code.

预先感谢.

推荐答案

这是一个两步过程.

首先,转到:

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=YOUR-API-ID&scope=r_basicprofile&state=STATE&redirect_uri=YOUR-ENCODED-REDIRECT-URI

然后,在收到响应的10秒内,转到:

Then, within 10 secs of receiving the response, go to:

https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&redirect_uri=YOUR-ENCODED-REDIRECT-URI&client_id=YOUR-API-ID&client_secret=YOUR-API-ID&code=THE-CODE-OBTAINED-IN-FIRST-STEP

第二个请求的响应将具有您需要使用的实际访问令牌.

The response of the second request will have the actual access token you need to use.

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

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