简体   繁体   English

将令牌保存在node_module文件夹内的npm包中

[英]Save token in a npm package inside node_module folder

Is there any proper way to save auth token in a client npm package? 有什么适当的方法可以将身份验证令牌保存在客户端npm软件包中?

Because i created gRPC server in golang and gRPC client side on javascript npm package, so i generated token in the server on correct password/email auth and send a token back to the npm package, so it can save it on the package and be attaching the token to the metadata on each request to server.. 因为我在golang和gRPC客户端的javascript npm软件包上创建了gRPC服务器,所以我在服务器上根据正确的密码/电子邮件身份验证生成了令牌,并将令牌发送回npm软件包,因此可以将其保存在软件包中并附加每个对服务器的请求中元数据的令牌。

My question is if there is a secure way to save the token on the client package or if there is a proper method for this? 我的问题是,是否存在将令牌保存在客户端软件包上的安全方法,或者是否有适当的方法?

在服务器端认证之后,您需要将令牌发送给客户端,并且客户端必须将令牌存储在localStorage中,并且可以使用请求头将此标头发送给服务器后认证的令牌。

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

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