简体   繁体   English

如何在hapi中获取登录的用户详细信息

[英]How to get the logged in user details in hapi

I have an endpoint /api/account where I am creating the details of an account but not passing user details anywhere just using the accesstoken to authorise the user using hapi-auth-bearer-simple . 我有一个端点/api/account ,我在其中创建/api/account的详细信息,但未使用hapi-auth-bearer-simple使用accesstoken来授权用户,因此未在任何地方传递用户详细信息。 Now I have a field called creator where I want to auto-populate the logged in user details like id and the name. 现在,我有一个名为creator的字段,我想在其中自动填充登录的用户详细信息,例如id和名称。

Could anyone suggest me how to do this? 谁能建议我该怎么做?

您通过auth方案传递的凭据可通过request.auth.credentials

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

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