Generating API tokens using node

后端 未结 4 1390
野趣味
野趣味 2021-02-01 20:28

I am writing an app that will expose an API. The application allows people to create workspaces and add users to them. Each user will have a unique token. When they make an API

4条回答
  •  佛祖请我去吃肉
    2021-02-01 21:14

    If you using mongodb just use ObjectId, othewise I recommend substack's hat module.

    To generate id is simple as

    var hat = require('hat');
    
    var id = hat();
    console.log(id); // 1c24171393dc5de04ffcb21f1182ab28
    

提交回复
热议问题