Reputation: 3103
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?
Upvotes: 0
Views: 719
Reputation: 8357
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:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
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.
Upvotes: 1