[英]Should I need to use many or single API key for a flutter app?
If I have an API as my back-end and flutter mobile application as my front end.如果我有一个 API 作为我的后端,flutter 移动应用程序作为我的前端。 To ensure that every request was made from the app I'm using a API key.为确保每个请求都是从应用程序发出的,我使用的是 API 密钥。
My question is that I have a single API key should I need to serve different API key for the users or else, A single API Key is enough for making requests?我的问题是,如果我需要为用户提供不同的 API 密钥,我只有一个 API 密钥,否则,一个 API 密钥是否足以发出请求?
Yes single API key is enough to make many request, just make sure that the API key doesn't st expire.是的,单个 API 密钥足以发出许多请求,只需确保 API 密钥不会过期即可。
you can save the API key as static variable in a class您可以将 API 密钥保存为 class 中的 static 变量
Class ApiKey{
static String apiKey = "YOUR_API_KEY";
}
and use it anywhere随处使用
print(ApiKey.apiKey);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.