Best approach for generating API key

后端 未结 5 1918
轮回少年
轮回少年 2020-12-04 07:37

So with lots of different services around now, Google APIs, Twitter API, Facebook API, etc etc.

Each service has an API key, like:

AIzaSyClzfrOzB818x55

5条回答
  •  长情又很酷
    2020-12-04 08:27

    An API key should be some random value. Random enough that it can't be predicted. It should not contain any details of the user or account that it's for. Using UUIDs is a good idea, if you're certain that the IDs created are random.

    Earlier versions of Windows produced predictable GUIDs, for example, but this is an old story.

提交回复
热议问题