简体   繁体   English

我应该为 flutter 应用程序使用多个或单个 API 密钥吗?

[英]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.

相关问题 如果列出客户端IP白色,我是否仍应使用API​​密钥 - Should I still use API key if client IP white listed 我应该如何保护与移动应用程序一起使用的API? - How should I secure an API for use with a mobile app? 如何使用apache httpClient API将文件+ api密钥和其他参数作为单个请求发送? - How do I use the apache httpClient API to send file + api key and other parameters as a single request? API 密钥在 Flutter Weather API 应用程序 (Android) 中不起作用 - API Key not working in Flutter Weather API App (Android) 我应该在代码库中的何处使用我的 Google API 密钥? - Where should I use my Google API Key in my code base? 使用 Ruby API 呈现 json 错误:我应该使用“错误”还是“消息”键? - render json errors with a Ruby API : should I use an 'error' or a 'message' key? 我需要在 Kotlin (Volley) 中实现一个 API 键 - I need to implement an API key in Kotlin (Volley) .NET Web应用程序中的Google Analytics(分析)请求。 我需要使用OAUTH还是只能将API密钥用于请求? - Google Analytics request in .NET Web Application. Do I need to use OAUTH or can i use API key only for request? 开发iOS应用程序时,有关我应该使用的API的问题。 (对SpriteKit的思考) - Developing an iOS app, questions about the API I should use. (thinking of SpriteKit) 对于匿名提交给API的应用程序,我应该使用哪种凭证系统? - What credentials system should I use for an app where submissions to an API are anonymous?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM