OAuth 2 fixes for Box & Picasa. Noticed that Box uses one refresh-token per authentication token, as soon as an Authenticating token is requested the refresh token is used. An refresh token can also expire, usually after 60 days. This commit should make it work.

This commit is contained in:
Robin 2015-04-18 00:06:57 +02:00
commit 6948df14f6
6 changed files with 144 additions and 66 deletions

View file

@ -60,7 +60,9 @@ namespace GreenshotPlugin.Controls {
// The script errors are suppressed by using the ExtendedWebBrowser
_browser.ScriptErrorsSuppressed = false;
_browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Browser_DocumentCompleted);
_browser.DocumentCompleted += Browser_DocumentCompleted;
_browser.Navigated += Browser_Navigated;
_browser.Navigating += Browser_Navigating;
_browser.Navigate(new Uri(authorizationLink));
}
@ -78,6 +80,16 @@ namespace GreenshotPlugin.Controls {
CheckUrl();
}
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
LOG.DebugFormat("Navigating to url: {0}", _browser.Url);
_addressTextBox.Text = e.Url.ToString();
}
private void Browser_Navigated(object sender, WebBrowserNavigatedEventArgs e) {
LOG.DebugFormat("Navigated to url: {0}", _browser.Url);
CheckUrl();
}
private void CheckUrl() {
if (_browser.Url.ToString().StartsWith(_callbackUrl)) {
string queryParams = _browser.Url.Query;