Hi, I've been using the following code for months and it suddenly
stopped to work. I can navigate correctly to the Authorization page
for the Picasa endpoint but always get a Denied response even after
pressing "Allow Access" button. The strange part is that using the
same URL on the browser (chrome, ie) the correct Authorization code
page is responded. C# on .NET, WebBrowser class is a simple,
native .NET browser control.
I suspect the OAuth2 service started responding bad this last few days
to something on the request, but hope someone has some info about it
(or where I can get further assistance or report the problem). Thnx.
public static void GetAuthorizationCode(string service, string
clientId, WebBrowser browser, Action<string> OnAuthorized, Action
OnDenied)
{
var url = String.Format(
"https://accounts.google.com/o/oauth2/auth?
client_id={0}&redirect_uri=urn:ietf:wg:oauth:
2.0:oob&response_type=code&scope={1}",
HttpUtility.UrlEncode(clientId),
HttpUtility.UrlEncode(service));
browser.DocumentCompleted += (sender,eventArgs) =>
{
var match = Regex.Match(browser.DocumentText,
"<title>([^=<]+) ([^=<]+)=([^<]+)</title>",RegexOptions.IgnoreCase);
if (match != null && match.Success &&
match.Groups.Count > 3)
{
if (match.Groups[3].Value.ToLower() ==
"access_denied")
OnDenied();
else if(match.Groups[2].Value.ToLower() == "code")
OnAuthorized(match.Groups[3].Value);
else
throw new ApplicationException("Unrecognized
reponse from Google OAuth2.");
}
};
browser.Navigate(url);
}
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-picasa-data-api?hl=en.