javascript - 使用 AngularJS Satellizer 模块的 Linkedin 身份验证

标签 javascript angularjs linkedin-api satellizer

我正在使用 Satellizer 模块进行社交登录和注册。 我能够对 Instagram 进行身份验证,但在 Linkedin 身份验证过程中,出现以下错误 -

{ 
  error_description: 'missing required parameters, includes an invalid parameter value, parameter more than once. : client_secret',
  error: 'invalid_request' 
}

我已经检查了很多次,但无法解决这个问题。 下面是我正在使用的代码-

var accessTokenUrl = 'https://www.linkedin.com/uas/oauth2/accessToken';
var peopleApiUrl = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,headline,location,industry,summary,specialties,positions,picture-urls::(original))';

var params = {
    client_id: req.body.clientId,
    client_secret: CLIENT_SECRET,
    code: req.body.code,
    redirect_uri: req.body.redirectUri,
    grant_type: 'authorization_code'
};
request.post(accessTokenUrl, {form: params, json: true }, function (err, response, body) {

    if (response.statusCode !== 200) {
        return res.status(response.statusCode).send({message: body.error_description});
    }
    var params = {
        oauth2_access_token: body.access_token,
        format: 'json'
    };
  // Other relevant code
 });

最佳答案

尝试为请求使用设置内容类型 header Content-Type: application/x-www-form-urlencoded

来自 LinkedIn

POST /oauth/v2/accessToken HTTP/1.1
    Host: www.linkedin.com
    Content-Type: application/x-www-form-urlencoded

    grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell

关于javascript - 使用 AngularJS Satellizer 模块的 Linkedin 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48820295/

相关文章:

javascript - 为什么我无法访问指令 html 中的 Controller 功能?

Linkedin 通过自定义 URL 共享后不显示文章描述

LinkedIn "share"API 未正确使用提供的 "content.description"

javascript - 如何将函数的值返回给其他函数

javascript - 如何在 Chrome 开发工具中使用 jQuery 遍历执行上下文?

javascript - 发送带有正文的 Angular $http.delete

AngularJS:$watch 来自 Controller ,用于更改使用 ng-repeat 创建的属性

linkedin-api - 验证后检查器 linkedin 中的链接会出现服务器错误

javascript - Google Maps V3 中的自定义工具提示/气泡

javascript - Angular : parent directive isn't affected by changes in its child