Generating API tokens using node

后端 未结 4 1384
野趣味
野趣味 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:23

    How does this code make sure your token is unique? I believe you could have collision of numbers with this code. I believe you need to have a sort of sequence number like in this commit from socket.io.

    Also you could use npm projects like for example:

    • UUIID (v4)
    • hat

    to ensure uniqueness.

提交回复
热议问题