在实时数据库(Firebase)上存储API密钥 [英] Storing API keys on the Realtime Database (Firebase)

查看:179
本文介绍了在实时数据库(Firebase)上存储API密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的android应用程序需要使用Google Place Search API,但由于它不适用于android,所以我必须调用Web API。我已经考虑过使用云功能,但是这太昂贵了,如果在每个客户端本地完成,可以少得多。问题是将API密钥存储在用户的设备上,因为它可以很容易地检索。因此,如果我把密钥存储在RT DB上并仅在需要的时候才引用它,那么它是安全的吗?

另外,如果你有什么建议,我更愿意实现它们:D在数据库中存储密钥仍然需要用户可以访问它。D

解决方案

因此,尽管检索的难度比较高,但恶意用户仍然可以检索到。



服务器端密钥不应该用在客户端代码中。


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?

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆