在实时数据库 (Firebase) 上存储 API 密钥

编程入门 行业动态 更新时间:2024-10-08 22:48:56
本文介绍了在实时数据库 (Firebase) 上存储 API 密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我的 android 应用程序需要使用 Google Place Search API,但由于它不适用于 android,我将不得不调用 Web API.我已经考虑过使用 Cloud Functions,但这太昂贵了,如果在每个客户端本地完成,成本会低很多.问题在于将 API 密钥存储在用户的设备上,因为它可以轻松检索.因此,如果我将密钥存储在 RT DB 上并仅在需要时引用它是否安全?

My android app requires using the Google Place Search API but since it's not available for android, I'll have to call the Web API. I've considered using Cloud Functions but that's too expensive and can be done for a lot less if done locally on each client. The problem is storing the API key on the user's devices as it can be easily retrieved. Thus is it safe if I store the key on the RT DB and reference it only when needed?

此外,如果您有任何建议,我非常乐意实施它们:D

Also, if you have suggestions, I'd me more than happy to implement them :D

推荐答案

将密钥存储在数据库中仍然需要用户可以访问它.因此,虽然检索的工作量增加了一级,但恶意用户仍然能够检索到它.

Storing the key in the database still requires that users can access it. So while it's one level more effort to retrieve, malicious users will still be able to retrieve it.

不应在客户端代码中使用服务器端密钥.

A server-side key should simply not be used in client-side code.

这篇关于在实时数据库 (Firebase) 上存储 API 密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 02:56:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/928293.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密钥   实时   数据库   Firebase   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!