xamarin/Xamarin.Auth — pull request #49 by livetocode (2013-12-28 00:13:48+00:00)
Title: Bug fix when using GoogleApps authentication

Hi,

Thanks for your excellent component. However, I had an issue when using it with Google Apps:
the authentication workflow worked great except that it was always displaying an error dialog that could simply get dismissed.
After a lot of investigation, I was able to narrow down the problem to just a few lines of code to fix it:
Google was redirecting to the registered callback (localhost) but the WebView was not able to connect to the host, as of course, our application is not a server!
So, I simply forced the WebView to ignore any redirect to a localhost server. I had to do it after your OnPageLoading processing, to let it detect the redirect containing the authorization code.
Also, I had to check in the LoadFailed event that the error code was not a 102, because this what the WebView throws when a navigation is stopped.

I extended your sample app to demonstrate the behaviour, using a custom Google app created in my domain.
If you want to verify what happens without my fix, just comment my code in the ShouldStartLoad event.

Hope this helps,

Morgan