swift - Twitter 回调 URL

标签 swift twitter authentication

我正在使用 Twitter SDK 与 iOS 应用程序集成。当我按照所有步骤创建客户 key 并将其放入我的应用程序时。当我运行该应用程序时,它显示 “[TwitterKit] 确实遇到了消息错误

"Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings" UserInfo={NSLocalizedDescription=Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings"

如何解决?

最佳答案

我遇到了同样的问题,TwitterKit 文档不准确或者 Twitter 改变了他们的政策。无论如何,在 Twitter Apps 站点上,回调 URL 必须非常具体地设置。回调 URL 应采用以下格式:

twitterkit-{consumer/api key}://

例如:

twitterkit-128238aKjqlp123AKdasdf://

此外,这需要在您的 Info.plist 中完全相同地注册:

<dict>
<key>CFBundleURLSchemes</key>
<array>
    <string>twitterkit-128238aKjqlp123AKdasdf</string>
</array>
</dict>

此处列出了更多文档:https://developer.twitter.com/en/docs/basics/callback_url.html

关于swift - Twitter 回调 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50601607/

相关文章:

authentication - Yesod 无 session 认证

php - Symfony 3 身份验证/登录表单不起作用

swift - 在多个弹出窗口和 Storyboard之间共享弹出按钮菜单?

swift - ViewForAnnotation 未在 Swift 3 中调用

java - Twitter twitter4j 2.2.5 中的空指针异常

javascript - 有没有办法在 twitter streaming api 过滤器上进行 AND 操作?

hadoop - 如何将所有收集的推文提取到一个文件中

php - 将 HybridAuth 与 CodeIgniter 2 结合使用

ios - 即使应用程序未运行,网络扩展也可监控 WiFi 网络变化

ios - 调用具有相同变量和值的子类