Auth0 LinkedIn social connection access_denied error: "Cannot read property 'values' of null"

Auth0 LinkedIn social connection access_denied error: "Cannot read property 'values' of null"

我正在使用 Auth0 进行 oauth 社交登录,到目前为止,我在将我的 Auth0 帐户连接到 LinkedIn 时没有遇到任何问题(在 https://auth0.com/docs/connections/social/linkedin 个月前遵循此处的指南)。

但是,最近我无法成功连接到LinkedIn。我没有对 Auth0 管理进行任何更改,事实上我的应用程序中也没有代码更改。当我尝试测试 LinkedIn 社交连接时,我得到 "Bummer! Something failed" 页面,并且提供的唯一错误详细信息如下:

{ "error": "access_denied", "error_description": "Cannot read property 'values' of null" }

考虑到我实际上没有对任何内容进行任何更改,而且此错误消息是有限的并且到目前为止似乎没有提供任何好的在线搜索结果,我很困惑。

我还尝试在 LinkedIn 开发者平台上创建一个新应用程序并将其连接到我的 auth0 帐户,在请求权限后,它在测试连接时导致了同样的错误。我希望只有 LinkedIn 开发人员可能知道发生了什么,但任何见解(甚至关于如何获得更详细的错误跟踪)都会有所帮助。谢谢!

检查你的规则。你可能像我一样制作了一张从 LinkedIn 获取全尺寸个人资料照片

https://manage.auth0.com/#/rules

需要将代码更新为 null 和空字符串检查 json

function (user, context, callback) {
    if (context.connection !== 'linkedin') {
        callback(null, user, context);
    }

    var request = require('request');
    var options = {
        url: 'https://api.linkedin.com/v1/people/~/picture-urls::(original)?format=json',
        headers: {
            Authorization: 'Bearer ' + user.identities[0].access_token
        }
    };

    request(options, function (error, response) {
        if (!error && response.statusCode === 200) {
            var json = JSON.parse(response.body);
            if (json !== null && json.values && json.values.length >= 1) {
                context.idToken.picture = json.values[0];
            }
        }
        callback(null, user, context);
    });
}