I am developing a Xamarin Mac application and I need to do some data syncing with Dropbox.
我正在开发一个Xamarin Mac应用程序,我需要与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.
我创建了一个WebView,它导航到一个URL,提示用户输入其用户名和密码。点击确定并成功登录后,我会看到一个新屏幕,我可以在Dropbox中的应用程序> AppName中授予或拒绝应用程序访问它的文件夹。
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.
无论击中取消还是允许没有任何反应。但是,如果我点击左上角的Dropbox图标,我会正常导航到我的仪表板。
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.
我认为这可能是一个Javascript问题或类似的东西,但我已经改变了我能想到的所有属性,我仍然停留在同一页面上。
What I need to set to be able to move on?
我需要设置什么才能继续前进?
1 个解决方案
#1
I have found the solution for my problem which is quite a strange one (IMO) but maybe it's the default way on OSX.
我找到了我的问题的解决方案,这是一个非常奇怪的解决方案(IMO),但也许这是OSX上的默认方式。
I subscribed to all event's the webView control has to offer and I found this "nugget".
我订阅了webView控件提供的所有事件,我发现了这个“金块”。
Once the user clicked on "Allow" the CancelClientRedirect
event was raised and by chance I found out that if you check out the
一旦用户点击“允许”,就会引发CancelClientRedirect事件,我偶然发现如果你查看了
YourWebViewControl.MainFrameUrl
you could see which callback URL should have been called.
你可以看到应该调用哪个回调URL。
It would either be http://yoururl.com/oauth=someRandomString
or http://yoururl.com/not_approved=true
.
它可能是http://yoururl.com/oauth=someRandomString或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.
根据此URL,您可以知道发生了什么(即app(未)授权),然后根据需要做任何您想做的事情。
Hope this might help someone out!
希望这可以帮助别人!
#1
I have found the solution for my problem which is quite a strange one (IMO) but maybe it's the default way on OSX.
我找到了我的问题的解决方案,这是一个非常奇怪的解决方案(IMO),但也许这是OSX上的默认方式。
I subscribed to all event's the webView control has to offer and I found this "nugget".
我订阅了webView控件提供的所有事件,我发现了这个“金块”。
Once the user clicked on "Allow" the CancelClientRedirect
event was raised and by chance I found out that if you check out the
一旦用户点击“允许”,就会引发CancelClientRedirect事件,我偶然发现如果你查看了
YourWebViewControl.MainFrameUrl
you could see which callback URL should have been called.
你可以看到应该调用哪个回调URL。
It would either be http://yoururl.com/oauth=someRandomString
or http://yoururl.com/not_approved=true
.
它可能是http://yoururl.com/oauth=someRandomString或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.
根据此URL,您可以知道发生了什么(即app(未)授权),然后根据需要做任何您想做的事情。
Hope this might help someone out!
希望这可以帮助别人!