private void FBLogin_Navigated(object sender, NavigationEventArgs e)
{
// whenever the browser navigates to a new url, try parsing the url.
// the url may be the result of OAuth 2.0 authentication.
var fb = new FacebookClient();
FacebookOAuthResult oauthResult;
if (fb.TryParseOAuthCallbackUrl(e.Uri, out oauthResult))
{
// The url is the result of OAuth 2.0 authentication
if (oauthResult.IsSuccess)
{
var accesstoken = oauthResult.AccessToken;
FBLogin.IsEnabled = false;
accessToken = accesstoken;
}
else
{
var errorDescription = oauthResult.ErrorDescription;
var errorReason = oauthResult.ErrorReason;
}
}
else
{
// The url is NOT the result of OAuth 2.0 authentication.
}
}