FlickrKit icon indicating copy to clipboard operation
FlickrKit copied to clipboard

Flickr doesn't recognise the "oauth_token" this application is trying to use

Open edgar-zigis opened this issue 6 years ago • 1 comments

Hello, I am trying to implement Flickr authorization, it seems that it succeeds to enter into project page, but after clicking at button which gives app permission - webview shows this message:

Flickr doesn't recognise the "oauth_token" this application is trying to use

I am using this code to authenticate: let url = URL(string: "flickrapp://auth") FlickrKit.shared().beginAuth(withCallbackURL: url!, permission: FKPermission.delete) { (url, error) in Tools.runAsync { if let error = error { self.showError(error.localizedDescription) } else { print(url?.absoluteString) let urlRequest = NSMutableURLRequest.init(url: url!, cachePolicy: NSURLRequest.CachePolicy.useProtocolCachePolicy, timeoutInterval: 30) self.flickrWebView.isHidden = false self.flickrWebView.loadRequest(urlRequest as URLRequest) } } }

I print url in webview and it prints generated oauth_token, so token is generated. However it fails at flickr.

edgar-zigis avatar Oct 02 '17 08:10 edgar-zigis

Sorry for the very late reply... however for the next person who reads this....

Sounds like you've missed the step with the callback URL. After you log in via Flickr successfully in the web view, Flickr redirects to your custom URL scheme that you configured when you setup your Flickr API Key, in the Callback URL section.

Example:

myscheme://auth?

This needs to be in your Info.plist file under URL Types > URL Schemes

You then need to ensure your app handles this in

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;
optional func application(_ application: UIApplication, handleOpen url: URL) -> Bool

You would then be calling this method on FlickrKit:

completeAuthWithURL

Something like that anyway... it's been a while since i worked on this... 😳

devedup avatar Apr 20 '20 16:04 devedup