iOS 应用程序中使用的 API 密钥和秘密

编程入门 行业动态 更新时间:2024-10-06 16:30:37
本文介绍了iOS 应用程序中使用的 API 密钥和秘密 - 将它们存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在为 iOS 开发,我需要使用 API 密钥和机密向某些 API 发出请求.但是,我不希望它在我的源代码中公开,并在我推送到我的存储库时泄露机密.

I'm developing for iOS and I need to make requests to certain APIs using an API key and a secret. However, I wouldn't like for it to be exposed in my source code and have the secret compromised when I push to my repository.

这种情况下的最佳做法是什么?将它写在一个单独的文件中,我将包含在 .gitignore 中?

What is the best practice for this case? Write it in a separate file which I'll include in .gitignore?

谢谢

推荐答案

这是一个非常古老的问题,但是如果有人在 google 中看到这个问题,我建议您尝试使用 CloudKit 来存储任何应用程序机密(API 密钥、Oauth 机密).只有您的应用程序可以访问您的应用程序容器,并且 Apple 和您的应用程序之间的通信是安全的.您可以在此处查看.

This is a very old question, but if anyone is seeing this in google I would suggest you try CloudKit for storing any App secrets (API keys, Oauth secrets). Only your app can access your app container and communication between Apple and your app is secure. You can check it out here.

这篇关于iOS 应用程序中使用的 API 密钥和秘密 - 将它们存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

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

发布评论

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

>www.elefans.com

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