You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented everything in your video but when i press the butto says the following:
"Not Logged In. you are not logged in. please login and try again"
Below is my code :
using System;
using System.Collections.Generic;
using diabetics_app.ViewModels;
using Xamarin.Forms;
namespace diabetics_app.Main
{
public partial class FacebookProfilePage : ContentPage
{
/// <summary>
/// Make sure to get a new ClientId from:
/// https://developers.facebook.com/apps/
/// </summary>
private string ClientId = "134161603894277";
// 134161603894277
public FacebookProfilePage()
{
InitializeComponent();
var apiRequest =
"https://www.facebook.com/v2.10/dialog/oauth?client_id="
+ ClientId
+ "&display=popup&response_type=token&redirect_uri=http://www.facebook.com/connect/login_success.html";
var webView = new WebView
{
Source = apiRequest,
HeightRequest = 1
};
webView.Navigated += WebViewOnNavigated;
Content = webView;
}
private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e)
{
var accessToken = ExtractAccessTokenFromUrl(e.Url);
if (accessToken != "")
{
var vm = BindingContext as FacebookViewModel;
await vm.SetFacebookUserProfileAsync(accessToken);
Content = MainStackLayout;
}
}
private string ExtractAccessTokenFromUrl(string url)
{
if (url.Contains("access_token") && url.Contains("&expires_in="))
{
var at = url.Replace("https://www.facebook.com/connect/login_success.html#access_token=", "");
if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
{
at = url.Replace("http://www.facebook.com/connect/login_success.html#access_token=", "");
}
var accessToken = at.Remove(at.IndexOf("&expires_in="));
return accessToken;
}
return string.Empty;
}
}
}
The text was updated successfully, but these errors were encountered:
LordDz....I also have same trouble, but I changed the Valid OAuth redirect URIs to http://www.facebook.com/connect/login_success.html and not successfully because that URL is not allowed so I can't change...What have I to do now? help me...
I implemented everything in your video but when i press the butto says the following:
"Not Logged In. you are not logged in. please login and try again"
Below is my code :
The text was updated successfully, but these errors were encountered: