简体   繁体   English

Auth0 获取其他用户客户端的配置文件

[英]Auth0 get profile of other user client side

To learn some new technologies, I am building a small chat application that allows users to send messages to each other.为了学习一些新技术,我正在构建一个允许用户相互发送消息的小型聊天应用程序。 I have set up my app with auth0 for client authentication and user management.我已经使用auth0设置我的应用程序以进行客户端身份验证和用户管理。 My chat messages include the sub of a user as the unique author_id .我的聊天消息包括用户的sub作为唯一的author_id

Now, for my use case, I would like everyone who has received a message to pull up a small user profile card for the message author.现在,对于我的用例,我希望收到消息的每个人都为消息作者拉出一个小的用户个人资料卡。 This means querying the user management system with the author_id to retrieve the user profile.这意味着使用author_id查询用户管理系统以检索用户配置文件。

I have found the get users by id endpoint which seems to fit my needs.我发现通过 id 端点获取用户似乎符合我的需要。 The problem here is that this API requires a management API token, which will not be available on the client side.这里的问题是这个 API 需要管理 API 令牌,这在客户端不可用。

Should I set up a pass-through API which authorizes users based on their app JWT token, and then requests the user profile from the auth0 API with the management token?我是否应该设置一个直通 API,它根据用户的应用程序 JWT 令牌授权用户,然后使用管理令牌从auth0 API 请求用户配置文件? Or should I be looking at a different approach (the fact that this API requires a management token seems to suggest so)?还是我应该考虑一种不同的方法(这个 API 需要管理令牌这一事实似乎表明了这一点)?

Due to the rate limit of the management API it is considered better practice to use an external database to save and retreive user data.由于管理 API 的速率限制,使用外部数据库保存和检索用户数据被认为是更好的做法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM