【问题标题】:auth0 get further information about userProfile in Androidauth0 获取有关 Android 中 userProfile 的更多信息
【发布时间】:2018-09-13 00:01:09
【问题描述】:

我正在使用 Auth0 和 Android。我的目的是检索有关用户的更多信息,而不是电子邮件和姓名,例如用户的生日。但我不能这样做,即使是任何其他文件 当我记录 userProfile 对象时;我有我喜欢的所有信息。但是当我喜欢在 textView 中显示生日时;我收到了这个错误

error: cannot find symbol method getGender()

这就是我编写简单代码的方式:

birthdayTextView.setText(String.format(getString(R.string.birthday), userProfile.getGender()));

【问题讨论】:

  • 看起来编译器抱怨它找不到名为 getGender() 的方法 - 显示生日时是否有理由调用性别?

标签: java android facebook-graph-api auth0


【解决方案1】:

错误表示没有userProfile.getGender()函数。

Auth0 规范化用户配置文件包含these attributes

为了完整起见,复制如下。但请注意,gender 不可用。

可能的解决方法:

一)。可以向user_metadata(最终用户可编辑)或app_metadata(最终用户不可编辑)添加自定义声明。

b)。也可以通过规则向令牌添加自定义声明。

规范化的用户个人资料声明

app_metadata: the custom fields storing information about a user. These attributes contain information that influences the user's access;

blocked*: the true/false value indicating if the user has been blocked;

created_at: the timestamp of when the user profile was first created;

email (unique): the user's email address

email_verified: the true/false value indicating if the user has verified their email address;

identities: the array of objects with information about the user's identities:

connection: the name of the connection used to authenticate the user;
isSocial: the true/false value indicating if the connection is a social one or not;
provider: the entity that is authenticating the user (such as Facebook, Twitter, and so on);
user_id: the user's unique identifier for this connection/provider.
multifactor: the list of multifactor providers in which the user is enrolled;

last_ip*: the IP address associated with the user's last login;

last_login*: the timestamp of when the user last logged in;

logins_count*: the number of times the user has logged in;

name: the user's name;

nickname: the user's nickname;

phone_number: the user's phone number;

phone_verified: the true/false value indicating whether the user's phone number has been verified (only valid for users with SMS connections);

picture: the user's profile picture, click here to learn more about the picture field;

updated_at: the timestamp of when the user's profile was last updated/modified;

user_id (unique): the user's unique identifier;

user_metadata: the custom fields storing information about a user. These attributes should contain information about the user that does not impact what they can or cannot access (such as work and home addresses);

username (unique): the user's username.

【讨论】:

  • 谢谢,但我想知道如何访问 user_id
  • Imen,感谢您的回答。回覆。问题 - 在回复中,您看到sub(主题)吗?如果您可以从 id 令牌中解析,id 令牌 sub 声明也是用户 ID。
猜你喜欢
  • 2020-04-24
  • 1970-01-01
  • 1970-01-01
  • 2016-01-29
  • 1970-01-01
  • 2014-12-07
  • 2019-05-08
  • 2011-09-30
  • 2017-06-15
相关资源
最近更新 更多