metadata - Not be able to console log Auth0 user_metadata. I created a custom rule I also see the data in postman.What am I doing wrong
问题描述
** I'm doing as following, I already created a custom rule.**
componentDidMount() {
console.log(token)
let response = fetch('https://DOmain.eu.auth0.com/userinfo', {
method: 'GET',
headers: {
Authorization: 'Bearer ' + token,
},
}).then((response) => response.json())
.then(responseJson => data = responseJson).then(console.log(data.nickname));
const metadata = data["https://Domain.eu.auth0.com/user_metadata"]
console.log(metadata);
}
My rule:
解决方案
您设置的规则看起来不错,但由于命名空间是 Auth0 域,因此无法正常工作
任何非 Auth0 HTTP 或 HTTPS URL 都可以用作命名空间标识符,并且可以使用任意数量的命名空间
试一试使用备用命名空间 example 'https://myapp.example.com/'
,您应该一切顺利!
作为旁注,我会尽量避免添加所有可能usermetadata
导致idtoken
生成的令牌太大的令牌。您还应该确保所包含的数据不敏感并且可以被披露。一些可能有帮助的项目,请在此处快速阅读:https ://auth0.com/docs/metadata和此处:https ://auth0.com/docs/scopes/current/custom-claims ,以帮助您一路走好!
推荐阅读
- c# - 可绑定条目在 Xamarin.forms 的自定义控件中不起作用?
- javascript - 如何在 Python 中从 Javascript 中获取变量
- python - tf.keras.models.model 与 tf.keras.model
- javascript - 使用 reduce API 从对象数组中删除属性
- reactjs - setState 在承诺中不起作用。使用 React 未定义的状态
- xml - 使用 bash 脚本在 XML 文件中查找选项块
- laravel - Laravel-Twilio 视频聊天“getUserMedia”错误
- javascript - 在 laravel 中使用 jquery 验证器时,表单未在模式弹出窗口内验证
- c# - 修剪 DataTable 中的所有单元格
- javascript - 通过首先单击选择 div 并取消选择其他人,通过第二次单击相同的 div 取消选择它