I am developing a Xamarin Mac application and I need to do some data syncing with Dropbox.
I have created a WebView which navigates to a URL where the user is prompted to enter its username and password. After hitting OK and successfully signing in I am presented with a new screen where I can grant or deny the app access to it's folder in Apps > AppName inside Dropbox.
Regardless of hitting Cancel or Allow nothing happens. If I however click on the Dropbox icon on the top left I am navigated normally to my dashboard.
I thought that this might be a Javascript problem or something similar but I have changed all the properties I can think of and I am still stuck on the same page.
What I need to set to be able to move on?
I have found the solution for my problem which is quite a strange one (IMO) but maybe it's the default way on OSX.
I subscribed to all event's the webView control has to offer and I found this "nugget".
Once the user clicked on "Allow" the CancelClientRedirect
event was raised and by chance I found out that if you check out the
YourWebViewControl.MainFrameUrl
you could see which callback URL should have been called.
It would either be http://yoururl.com/oauth=someRandomString
or http://yoururl.com/not_approved=true
.
Based on this URL you can then know what happened (i.e. app (not) authorized) and then do whatever you want in response to that.
Hope this might help someone out!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With