ios - Github API 回调地址

标签 ios swift oauth github-api

我正在尝试使用 Swift 为 iOS 编写一个 github 客户端。到目前为止,我设法了解了 OAuth 2.0 的工作原理。 但我不明白的是,在 OAuth 应用程序列表中注册我的应用程序时,我应该输入什么回调 URL(以便用户在处理 OAuth 后被重定向)。我在 Info.plist 中添加了类似“mycustomapp”的 URL 方案,然后在 developer.github 网站的回调 url 字段中输入“mycustomapp://”,但它说,这个 url 无效。我应该使用什么网址?

最佳答案

我已经设法在 oAuthSwift wiki 页面上找到了这个问题的解决方案。 某些 API 不接受自定义 url 方案(例如:myapp://)到回调 URL(例如:Linkedin oauth v2、Twitter oauth v1),只接受 http。 所以我使用了一个带有 http 方案的 URL,它重定向到我的自定义方案。 我输入 http://oauthswift.herokuapp.com/callback/myappname 作为回调,在我的应用程序中我重定向到 oauth-swift://oauth-callback/myappname 代码可以在这里找到 https://github.com/dongri/oauthswift.herokuapp.com

关于ios - Github API 回调地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42846733/

相关文章:

ios - UIImagePickerController 没有可见接口(interface)声明选择器 isSourceTypeAvailable

ios - Swift firebase 获取数据

ios - 对包括导航栏和选项卡栏的 View 进行快照

ios - 我如何检测我的应用程序用户正在使用什么设备

ios - 用一个视频加载两个 AVPlayer

macos - OSX 核心数据 : issue only for some entities: +entityForName: could not locate an entity named 'myEntity' in this model

android - Android 和 iPhone 移动应用开发时如何管理图片和图标

Android Oauth随机返回认证错误 "nonce_used"

api - OAuth(访问 token )与 API key

javascript - 限制 API 使用