简体   繁体   中英

Save token in a npm package inside node_module folder

Is there any proper way to save auth token in a client npm package?

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..

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中,并且可以使用请求头将此标头发送给服务器后认证的令牌。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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