【问题标题】:How to get full user data in Auth0 using /users API?如何使用 /users API 在 Auth0 中获取完整的用户数据?
【发布时间】:2022-03-02 19:50:15
【问题描述】:

根据这篇文章https://auth0.com/docs/api/authentication#get-user-info,我可以获得用户信息。挑战在于,我获得的不是完整的用户信息,而是部分信息。

我在我的 JWT 中定义了 "scope": "openid profile email"。如何检索完整信息?我错过了什么吗?

代码:

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://YOUR_DOMAIN/userinfo',
  'headers': {
    'Authorization': 'Bearer {TOKEN}',
    'Cookie': 'COOKIE'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

实际反应:

{
    "email": "janedoe@exampleco.com",
    "email_verified": true,
    "name": "Jane Josephine Doe",
    "nickname": "JJ",
    "picture": "http://exampleco.com/janedoe/me.jpg",
    "sub": "248289761001",
    "updated_at": "1556845729"
}

预期响应:

{
    "address": {
        "country": "us"
    },
    "birthdate": "1972-03-31",
    "email": "janedoe@exampleco.com",
    "email_verified": true,
    "family_name": "Doe",
    "gender": "female",
    "given_name": "Jane",
    "locale": "en-US",
    "middle_name": "Josephine",
    "name": "Jane Josephine Doe",
    "nickname": "JJ",
    "phone_number": "+1 (111) 222-3434",
    "phone_number_verified": false,
    "picture": "http://exampleco.com/janedoe/me.jpg",
    "preferred_username": "j.doe",
    "profile": "http://exampleco.com/janedoe",
    "sub": "248289761001",
    "updated_at": "1556845729",
    "website": "http://exampleco.com",
    "zoneinfo": "America/Los_Angeles"
}

【问题讨论】:

    标签: node.js auth0


    【解决方案1】:

    您可以创建一些操作并调用它们,因为您将在函数中获取所有用户详细信息。

    登录到 Auth0 >>> 左侧菜单栏 >>> 库 >> 操作

    【讨论】:

      猜你喜欢
      • 2018-06-28
      • 1970-01-01
      • 1970-01-01
      • 2019-08-01
      • 2016-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多