代码之家  ›  专栏  ›  技术社区  ›  Aman

使用AngularJS Satellizer模块进行Linkedin身份验证

  •  1
  • Aman  · 技术社区  · 6 年前

    我正在使用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
     });
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   Matej Marconak    6 年前

    尝试对请求使用set content type标头 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