用户授权失败时iPhone Flickr API回调URL
我正在使用 flickr 的 API 通过遵循基于 Web 的应用程序身份验证流程来授权 iPhone 应用程序。如果用户授权应用程序,则会调用回调 URL,一切都会顺利进行。但是,如果用户拒绝该应用程序,浏览器将被转发到 flickr 网站的另一部分,并且由于我们使用浏览器在 iPhone 中进行身份验证,因此用户仍处于 safari 状态。有没有办法让我的应用程序知道它被用户拒绝,返回到我的应用程序,以便我可以优雅地处理拒绝和/或错误?
I am using flickr's API to authorize an iPhone app by following their web based applications authentication flow. If the user authorizes the application a callback URL is called and everything runs smoothly. However, if the user denies the application, the browser is forwarded to another part of flickr's site, and because we are using a browser to authenticate in the iPhone, the user remains in safari. Is there a way for my application to know that it was denied by the user, return to my application, so that I can handle the denial and/or error gracefully?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我根本不了解 Flickr API,也从未使用过它,但我想到的一个想法如下:使用应用程序内 UIWebView 而不是 safari 并设置委托属性 (UIWebViewDelegate 协议)。然后,您的委托应该实现以下方法:
通过请求对象,您可以检索正在调用的 URL,并检查它是否符合失败的授权 URL 的方案。可能有一种更优雅的方法来检查身份验证失败(事实上我很确定确实存在),但这应该可行。
I don't know the Flickr API at all and have never worked with it, but one idea that came to my mind is the following: Use an in-App UIWebView instead of safari and set the delegate property (UIWebViewDelegate protocol). Your delegate should then implement the following method:
Through the request object you can retrieve the URL being called and check whether it fits the scheme of a failed authorization URL. There might be a more elegant way to check for a failure in authentication (in fact I am pretty sure there is), yet this should work.