private void button1_Click(object sender, EventArgs e) { if (button1.Text == "Log Out") { logout(); } else { webBrowser1.Visible = true; // webBrowser1.Navigate("https://www.facebook.com/v1.0/dialog/oauth?redirect_uri=http://www.nokia.com/en_int/Copy_All_This_Url&scope=email%2Cpublish_actions%2Cuser_about_me%2Cuser_actions.books%2Cuser_actions.music%2Cuser_actions.news%2Cuser_actions.video%2Cuser_activities%2Cuser_birthday%2Cuser_education_history%2Cuser_events%2Cuser_games_activity%2Cuser_groups%2Cuser_hometown%2Cuser_interests%2Cuser_likes%2Cuser_location%2Cuser_notes%2Cuser_photos%2Cuser_questions%2Cuser_relationship_details%2Cuser_relationships%2Cuser_religion_politics%2Cuser_status%2Cuser_subscriptions%2Cuser_videos%2Cuser_website%2Cuser_work_history%2Cfriends_about_me%2Cfriends_actions.books%2Cfriends_actions.music%2Cfriends_actions.news%2Cfriends_actions.video%2Cfriends_activities%2Cfriends_birthday%2Cfriends_education_history%2Cfriends_events%2Cfriends_games_activity%2Cfriends_groups%2Cfriends_hometown%2Cfriends_interests%2Cfriends_likes%2Cfriends_location%2Cfriends_notes%2Cfriends_photos%2Cfriends_questions%2Cfriends_relationship_details%2Cfriends_relationships%2Cfriends_religion_politics%2Cfriends_status%2Cfriends_subscriptions%2Cfriends_videos%2Cfriends_website%2Cfriends_work_history%2Cads_management%2Ccreate_event%2Ccreate_note%2Cexport_stream%2Cfriends_online_presence%2Cmanage_friendlists%2Cmanage_notifications%2Cmanage_pages%2Cphoto_upload%2Cpublish_stream%2Cread_friendlists%2Cread_insights%2Cread_mailbox%2Cread_page_mailboxes%2Cread_requests%2Cread_stream%2Crsvp_event%2Cshare_item%2Csms%2Cstatus_update%2Cuser_online_presence%2Cvideo_upload%2Cxmpp_login&response_type=token+code&client_id=200758583311692&_rdr"); webBrowser1.Navigate(fb.GetLoginUrl(new { //client_id = "41158896424", client_id = "124024574287414", //client_id = "6628568379", authorizeUrl = "https://www.instagram.com", redirect_uri = "https://www.instagram.com/accounts/signup/index/", //redirect_uri = "http://www.sharpdroid.com/", response_type = "token", //scope = "publish_actions,publish_pages,manage_pages,user_groups,publish_actions,email,user_likes,publish_stream,user_friends,public_profile" // Add other permissions as needed scope = "user_birthday, user_religion_politics, user_relationships, user_relationship_details, user_hometown, user_location, user_likes, user_education_history, user_work_history, user_website, user_groups, user_managed_groups, user_events, user_photos, user_videos, user_friends, user_about_me, user_status, user_games_activity, user_posts, read_stream, read_mailbox, email, manage_pages, publish_pages, publish_actions, read_custom_friendlists, user_actions.books, user_actions.music, user_actions.video, user_actions.news, public_profile,manage_pages,publish_actions,publish_pages" })); } }
public void MobileIsTrueThen_ShouldGenerateMobileLoginUrl() { var loginParameters = new Dictionary <string, object>(); loginParameters["mobile"] = true; var loginUrl = _fb.GetLoginUrl(loginParameters); Assert.Equal("https://m.facebook.com/dialog/oauth", loginUrl.AbsoluteUri); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Uri loginUrl; if (_url == "") { if (Kernel.FacebookClient != null) { return; } var fb = new FacebookClient(); const string redirectUrl = "https://www.facebook.com/connect/login_success.html"; loginUrl = fb.GetLoginUrl(new { client_id = 1514638988814629, redirect_uri = redirectUrl, scope = Permissions, display = "popup", response_type = "token" }); } else { var logoutParameters = new Dictionary <string, object> { { "next", "http://votc.bitflash.xyz" } }; loginUrl = Kernel.FacebookClient.GetLogoutUrl(logoutParameters); } Webbrowser.Navigated += WebBrowserNavigated; Webbrowser.Navigate(loginUrl); }
private Uri GenerateFacebookLoginUrl(string appId, string extendedPermissions) { // copied from http://stackoverflow.com/questions/29621427/facebook-sdk-integration-in-wpf-application dynamic parameters = new ExpandoObject(); parameters.client_id = appId; parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; // The requested response: an access token (token), an authorization code (code), or both (code token). parameters.response_type = "token"; // list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display parameters.display = "popup"; // add the 'scope' parameter only if we have extendedPermissions. if (!string.IsNullOrWhiteSpace(extendedPermissions)) { parameters.scope = extendedPermissions; } // generate the login url var fb = new FacebookClient(); return(fb.GetLoginUrl(parameters)); }
public FacebookService(ISettingsService settingsService) { _settingsService = settingsService; var fb = new FacebookClient(); _loginUri = fb.GetLoginUrl(new { display = "popup", response_type = "token", redirect_uri = _callbackUri, client_id = AppID, scope = "email" }); try { //if (ApplicationData.Current.LocalSettings.Values.ContainsKey(nameof(AccessToken))) //{ // AccessToken = ApplicationData.Current.LocalSettings.Values[nameof(AccessToken)] as string; //} AccessToken = new PasswordVault().Retrieve("Onlab", nameof(AccessToken)).Password; //kivetelt dob ha nem talalja meg, le kell kezelni Task.Run(() => GetUserAsync()); //TODO: ez itt nagyon nem jo } catch (COMException e) when(e.Message.Contains("Cannot get credential from Vault")) { //ha nem sikerult bejelentkezni facen erdemes a biztonsag kedveert a Default felhasznalot betolteni LoadUserFromDatabase("Default"); } }
private Uri GenerateLoginUrl(string appId, string extendedPermissions) { if (string.IsNullOrEmpty(appId)) { throw new ArgumentNullException("appId"); } // Make sure to set the app id. //var oauthClient = new Facebook.FacebookOAuthClient { AppId = appId }; IDictionary <string, object> loginParameters = new Dictionary <string, object>(); loginParameters["client_id"] = appId; loginParameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; // The requested response: an access token (token), an authorization code (code), or both (code token). loginParameters["response_type"] = "token"; // list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display loginParameters["display"] = "popup"; // add the 'scope' parameter only if we have extendedPermissions. if (!string.IsNullOrEmpty(extendedPermissions)) { // A comma-delimited list of permissions loginParameters["scope"] = extendedPermissions; } // when the Form is loaded navigate to the login url. return(_fb.GetLoginUrl(loginParameters)); //oauthClient.GetLoginUrl(loginParameters); }
public ActionResult AuthenticateFacebook() { // Build the Return URI form the Request Url var redirectUri = new UriBuilder(Request.Url); redirectUri.Path = RedirectUrl; var client = new FacebookClient(); // Generate the Facebook OAuth URL // Example: https://www.facebook.com/dialog/oauth? // client_id=YOUR_APP_ID // &redirect_uri=YOUR_REDIRECT_URI // &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES // &state=SOME_ARBITRARY_BUT_UNIQUE_STRING var uri = client.GetLoginUrl(new { client_id = SocialMediaConnectConstants.AppId, redirect_uri = RedirectUrl, scope = "email" , }); return(Redirect(uri.ToString())); }
public Task <NavigationState> LoginAsync() { CurrentRequest = FacebookRequest.Login; if (_callbackHook != null || _fb == null) { ChangeNavigationState(NavigationState.Error); return(Task.FromResult <NavigationState>(NavigationState.Error)); } if (IsLoggedIn) { return(Task.FromResult <NavigationState>(NavigationState.Done)); } // Perform a proper login var uri = _fb.GetLoginUrl(new { redirect_uri = RedirectUrl, scope = PermissionsString, display = "popup", response_type = "token" }); CreateTask(); ChangeNavigationState(NavigationState.Navigating); _web.Navigate(uri); return(_callbackHook); }
public ActionResult Facebook(string twitterUserId) { var meleeUser = _userRepository.Get(twitterUserId); if (meleeUser.Connections.All(c => c.ConnectionName != "Facebook")) { var facebookKey = ConfigurationManager.AppSettings["FacebookKey"]; var facebookSecret = ConfigurationManager.AppSettings["FacebookSecret"]; var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = facebookKey, client_secret = facebookSecret, redirect_uri = FacebookRedirectUri.AbsoluteUri, response_type = "code", scope = "email,user_status, user_photos, read_stream, read_insights, user_online_presence" }); return(Redirect(loginUrl.AbsoluteUri)); } else { _repository.Delete(meleeUser.UserId, meleeUser.Connections.First(c => c.ConnectionName == "Facebook").ConnectionId); meleeUser.Connections.Remove(meleeUser.Connections.First(c => c.ConnectionName == "Facebook")); } return(View("../Home/MyProfile", meleeUser)); }
public void Login() { dynamic parameters = new ExpandoObject(); parameters.client_id = AppId; parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; // The requested responce: an access token (token), as authorization code (code), or both (code token). parameters.response_type = "token"; // list of additional display modes can be fount as https://develops.facebook.com/docs/reference/dialogs/............ parameters.display = "popup"; // add the ;scope' parameter only if we have extendedPermissions. if (!string.IsNullOrWhiteSpace(_ExtendedPermissions)) { parameters.scope = _ExtendedPermissions; } // generate the login url var fb = new FacebookClient(); _loginUrl = fb.GetLoginUrl(parameters); //_logoutUrl = fb.GetLogoutUrl(parameters); webBrowserLogin.Navigate(_loginUrl.AbsoluteUri); //webBrowser1.Navigate(_logoutUrl.AbsoluteUri); //if you want to logout }
private Uri GenerateLoginUrl() { // for .net 3.5 // var parameters = new Dictionary<string,object> // parameters["client_id"] = appId; dynamic parameters = new ExpandoObject(); parameters.client_id = Data.Get("id"); parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; // The requested response: an access token (token), an authorization code (code), or both (code token). parameters.response_type = "token"; // list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display parameters.display = "popup"; // add the 'scope' parameter only if we have extendedPermissions. parameters.scope = "public_profile, basic_info, publish_checkins, status_update, photo_upload, video_upload, create_note, share_item, publish_stream, manage_notifications, publish_actions, user_friends,user_groups"; // generate the login url var fb = new FacebookClient(); return(fb.GetLoginUrl(parameters)); }
private async Task <string> AuthenticateFacebookAsync() { try { var fb = new FacebookClient(); var loginUri = fb.GetLoginUrl(new { client_id = AppId, redirect_uri = FbSuccess, scope = ExtendedPermissions, display = "popup", response_type = "token" }); var authenticationResult = await FacebookAuthenticationBroker.AuthenticateAsync(loginUri); return(ParseAuthenticationResult(authenticationResult)); } catch (Exception ex) { return(ex.Message); } }
public void login() { string ExtendedPermissions = "email"; dynamic parameters = new ExpandoObject(); parameters.client_id = "264036641444914"; parameters.client_secret = "c55fb165844a8b2806577fc0971170a1"; parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; parameters.response_type = "token"; parameters.display = "popup"; if (!string.IsNullOrWhiteSpace(ExtendedPermissions)) { parameters.scope = ExtendedPermissions; } var fb = new FacebookClient(); Uri _loginUrl = fb.GetLoginUrl(parameters); Process.Start(new ProcessStartInfo(_loginUrl.AbsoluteUri) { UseShellExecute = true }); f.bunifuPages1.SetPage(1); }
internal static Uri GetLoginUrl( this FacebookClient client, string redirectUrl, string appId, string permissions ) { if (String.IsNullOrEmpty(redirectUrl)) { throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, "redirectUrl"); } if (String.IsNullOrEmpty(appId)) { throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, "appId"); } Dictionary <string, object> loginUrlParameters = new Dictionary <string, object>(); loginUrlParameters["redirect_uri"] = redirectUrl; loginUrlParameters["client_id"] = appId; if (!String.IsNullOrEmpty(permissions)) { loginUrlParameters["scope"] = permissions; } return(client.GetLoginUrl(loginUrlParameters)); }
public ActionResult SignUpFacebook() { // Build the Return URI form the Request Url var redirectUri = new UriBuilder(Request.Url); redirectUri.Path = Url.Action("FbAuth", "Account"); //Get the Public Uri due to apphabor getting all "cloudy" with ports var urlHelper = new UrlHelper(Request.RequestContext); var publicUrl = urlHelper.ToPublicUrl(redirectUri.Uri); var client = new FacebookClient(); #region Facebook OAuth URL example // Generate the Facebook OAuth URL // Example: https://www.facebook.com/dialog/oauth? // client_id=YOUR_APP_ID // &redirect_uri=YOUR_REDIRECT_URI // &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES // &state=SOME_ARBITRARY_BUT_UNIQUE_STRING #endregion //Create the Facebook Oauth URL var uri = client.GetLoginUrl(new { client_id = ConfigurationManager.AppSettings["FacebookAppId"], redirect_uri = publicUrl, scope = "email", }); return(Redirect(uri.ToString())); }
private async Task Login() { //Client ID of the Facebook App (retrieved from the Facebook Developers portal) //Required permissions var scope = "public_profile, email"; var redirectUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString(); var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = ClientId, redirect_uri = redirectUri, response_type = "token", scope = scope }); Uri startUri = loginUrl; Uri endUri = new Uri(redirectUri, UriKind.Absolute); #if WINDOWS_PHONE_APP WebAuthenticationBroker.AuthenticateAndContinue(startUri, endUri, null, WebAuthenticationOptions.None); #endif #if WINDOWS_APP WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, startUri, endUri); await ParseAuthenticationResult(result); #endif }
public void Login() { //dynamic parameters = new ExpandoObject(); Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters["response_type"] = "token"; //la valeur Token car on a besoin d'accès parameters["display"] = "popup"; //La valeur Touch est addapté pour les appli Mobile //la valeur Scope corresponds aux infos qu'on veut obtenir de la prt de l'utilisateur //parameters["scope"] = "user_about_me, friends_about_me, user_birthday, friends_birthday, publish_stream"; parameters["scope"] = "email"; parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; parameters["client_id"] = "447994412411310"; parameters["client_secret"] = "918fff2c4753781ccdaef1a0ea0eda0f"; //parameters.client_id = AppID; //parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; //parameters.response_type = "token"; //parameters.display = "popup"; if (!string.IsNullOrWhiteSpace(_ExtendedPermissions)) { //parameters.scope = _ExtendedPermissions; parameters["scope"] = _ExtendedPermissions; } FacebookClient client = new FacebookClient(); Uri uri = client.GetLoginUrl(parameters); Response.Redirect(uri.AbsoluteUri); }
public static void Login(string permissions, FacebookDelegate callback) { if (_web == null) { throw new MissingScaffoldingException(); } if (_web.IsActive || IsLoggedIn) { // Already in use if (callback != null) { callback(new FBResult() { Error = "Already in use" }); } return; } var uri = _client.GetLoginUrl(new { redirect_uri = _redirectUrl, scope = permissions, display = "popup", response_type = "token" }); _web.ClearCookies(); _web.Navigate(uri, true, onError: LoginNavigationError, state: callback, startedCallback: LoginNavigationStarted); if (_onHideUnity != null) { _onHideUnity(true); } }
private Uri GenerateLoginUrl(string appId, string extendedPermissions) { // for .net 3.5 // var parameters = new Dictionary<string,object> // parameters["client_id"] = appId; dynamic parameters = new ExpandoObject(); parameters.client_id = appId; parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; // The requested response: an access token (token), an authorization code (code), or both (code token). parameters.response_type = "token"; // list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display parameters.display = "popup"; // add the 'scope' parameter only if we have extendedPermissions. if (!string.IsNullOrWhiteSpace(extendedPermissions)) { parameters.scope = extendedPermissions; } // when the Form is loaded navigate to the login url. return(_fb.GetLoginUrl(parameters)); }
private async void AttemptLogin() { if (_client != null) { return; } if (apiKey == null) { return; } _client = new FacebookClient(); _client.AppId = apiKey.APIKey; _client.AppSecret = apiKey.APISecret; //var scope = "public_profile, email"; var scope = "public_profile,user_friends,email, user_about_me, user_hometown, user_location, user_photos, user_posts, user_status, user_videos, user_website"; var redirectUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString(); var fb = new FacebookClient(); Uri loginUrl = fb.GetLoginUrl(new { client_id = apiKey.APIKey, redirect_uri = redirectUri, response_type = "token", scope = scope }); Uri startUri = loginUrl; Uri endUri = new Uri(redirectUri, UriKind.Absolute); WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, startUri, endUri); ParseAuthenticationResult(result); }
public string CallBack(string mrfid, string ReturnUrl) { client.AppId = AppId; client.AppSecret = AppSecret; dynamic token = client.Get("oauth/access_token", new { client_id = AppId, client_secret = AppSecret, grant_type = "client_credentials", fields = "public_actions,public_profile", }); var redirect_uri = new System.UriBuilder(Request.Url.AbsoluteUri) { Path = Url.Action("ReturnUrl", "facebook"), Query = null, }; var url = client.GetLoginUrl(new { client_id = client.AppId, client_secret = client.AppSecret, redirect_uri = redirect_uri.Uri.AbsoluteUri + "?token=" + Token + "&mrfid=" + mrfid + "&returnurl=" + ReturnUrl }).AbsoluteUri; return(url); }
private static string BuildLoginUrl(string appId, string redirectUri, IEnumerable <string> scopes, object state) { var parameters = new Dictionary <string, object>(); parameters["client_id"] = appId; parameters["response_type"] = "code"; //Must be code, because token is not returned in query string parameters["display"] = Display.ToString().ToLowerInvariant(); parameters["redirect_uri"] = redirectUri; if (state != null) { parameters["state"] = state; } //Add the scope parameter only if we have some scopes. if (scopes != null) { string scope = string.Join(",", scopes); if (!string.IsNullOrEmpty(scope)) { parameters["scope"] = scope; } } var fb = new FacebookClient(); return(fb.GetLoginUrl(parameters).AbsoluteUri); }
public ActionResult LoginWithGooglePlus(FormCollection form) { if (form["provider"] == "Google") { GoogleConnect.ClientId = "896622894562-eams8dj01aesjt83rq08v7n7qlr42esv.apps.googleusercontent.com"; GoogleConnect.ClientSecret = "25WEHFLJlTP1136mJx7X4sQb"; GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0]; // GoogleConnect.RedirectUri = "http://localhost:51442/LoginSocial/LoginWithGooglePlus"; GoogleConnect.Authorize("profile", "email"); return(RedirectToAction("LoginWithGooglePlusConfirmed")); } else if (form["provider"] == "Facebook") { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = ConfigurationManager.AppSettings["FbAppId"], client_secret = ConfigurationManager.AppSettings["FbAppSecret"], redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" }); return(Redirect(loginUrl.AbsoluteUri)); } return(RedirectToAction("LoginWithGooglePlusConfirmed")); }
private async Task <string> AuthenticateFacebookAsync() { try { var fb = new FacebookClient(); var redirectUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString(); var loginUri = fb.GetLoginUrl(new { client_id = AppId, redirect_uri = redirectUri, scope = ExtendedPermissions, display = "popup", response_type = "token" }); var callbackUri = new Uri(redirectUri, UriKind.Absolute); var authenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, loginUri, callbackUri); return(ParseAuthenticationResult(fb, authenticationResult)); } catch (Exception ex) { return(ex.Message); } }
public RedirectResult GetFacebookLoginURL() { if (Session["AccessTokenRetryCount"] == null || (Session["AccessTokenRetryCount"] != null && Session["AccessTokenRetryCount"].ToString() == "0")) { Session.Add("AccessTokenRetryCount", "1"); FacebookClient fb = new FacebookClient(); fb.AppId = ConfigurationManager.AppSettings["Facebook_AppId"]; return(Redirect(fb.GetLoginUrl(new { scope = ConfigurationManager.AppSettings["Facebook_Scope"], redirect_uri = RedirectUri.AbsoluteUri, response_type = "code" }).ToString())); } else { return(Redirect(Url.Action("Index", "Message", new MessageViewModel { Type = "Error", Message = "Unable to obtain a valid Facebook Token after multiple attempts please contact support" }))); } }
public Uri GetLoginUrl() { // for .net 3.5 var parameters = new Dictionary <string, object>(); parameters["client_id"] = appID; parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; //dynamic parameters = new ExpandoObject(); //parameters.client_id = appId; //parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; // The requested response: an access token (token), an authorization code (code), or both (code token). parameters["response_type"] = "token"; // list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display parameters["display"] = "popup";//"touch"; // add the 'scope' parameter only if we have extendedPermissions. if (!string.IsNullOrWhiteSpace(extendedPermissions)) { parameters["scope"] = extendedPermissions; } // generate the login url //var fb = new FacebookClient(); return(fbClient.GetLoginUrl(parameters)); }
/// <summary> /// Returns an <see cref="ActionResult"/> that indicates we want to show a permission prompt. Should only be used as a /// return value within the <see cref="OnPermissionPrompt"/> and <see cref="OnDeniedPermissionPrompt"/> methods. /// </summary> /// <returns>An <see cref="ActionResult"/> that indicates that we want to show a permission prompt.</returns> protected ShowPromptResult ShowPrompt(PermissionContext context) { FacebookClient client = context.FacebookContext.Client; Uri navigationUrl = client.GetLoginUrl(context.RedirectUrl, _config.AppId, permissions: String.Join(",", context.RequiredPermissions)); return(new ShowPromptResult(navigationUrl)); }
/// <summary> /// Binds the model to a value by using the specified controller context and binding context. /// </summary> /// <param name="controllerContext">The controller context.</param> /// <param name="bindingContext">The binding context.</param> /// <returns> /// The bound value. /// </returns> public virtual object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext ) { HttpRequestBase request = controllerContext.HttpContext.Request; string originUrl = request.QueryString["originUrl"]; string permissions = request.QueryString["permissions"]; if (!String.IsNullOrEmpty(originUrl)) { if (!originUrl.StartsWith(_config.AppUrl, StringComparison.OrdinalIgnoreCase)) { bindingContext.ModelState.AddModelError( bindingContext.ModelName, String.Format( CultureInfo.CurrentCulture, Resources.UrlCannotBeExternal, "originUrl", _config.AppUrl ) ); } } else { bindingContext.ModelState.AddModelError( bindingContext.ModelName, String.Format( CultureInfo.CurrentCulture, Resources.ParameterIsRequired, "originUrl" ) ); } string redirectUrl = null; string[] requiredPermissions = permissions != null?permissions.Split(',') : new string[0]; if (bindingContext.ModelState.IsValid) { FacebookClient client = _config.ClientProvider.CreateClient(); // Don't want to redirect to a permissioned URL, the action authorize filters take care of that. redirectUrl = client.GetLoginUrl(originUrl, _config.AppId, String.Empty).AbsoluteUri; } return(new FacebookRedirectContext { OriginUrl = originUrl, RequiredPermissions = requiredPermissions, RedirectUrl = redirectUrl, Configuration = _config }); }
private void PromptDefaultPermissions(PermissionContext permissionContext, string redirectUrl) { FacebookClient client = permissionContext.FacebookContext.Client; // Cannot obtain user information from signed_request, redirect to Facebook OAuth dialog. Uri navigationUrl = client.GetLoginUrl(redirectUrl, _config.AppId, permissions: null); permissionContext.FilterContext.Result = CreateRedirectResult(navigationUrl); }
public Uri GenerateLoginURL() { fbClient.AppId = APP_ID; var loginParameters = new Dictionary <string, object>(); loginParameters["client_secret"] = CLIENT_SECRET; loginParameters["response_type"] = REDIRECT_TYPE; loginParameters["redirect_uri"] = REDIRECT_URL; return(fbClient.GetLoginUrl(loginParameters)); }
public void BindFacebookAccount( GetUserCredentials getCredentials ) { Dictionary<string, object> loginRequest = FacebookManager.Instance.CreateLoginRequest( ); FacebookClient fbSession = new FacebookClient( ); string requestUri = fbSession.GetLoginUrl( loginRequest ).AbsoluteUri; getCredentials( requestUri, fbSession ); }
private Uri GetLoginUrl(string permissions) { var parameters = new Dictionary<string, object>(); parameters["client_id"] = this.AppId; parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; parameters["response_type"] = "token"; #if WINDOWS_PHONE parameters["display"] = "touch"; parameters["mobile"] = true; #else parameters["display"] = "popup"; #endif // add the 'scope' only if we have extendedPermissions. if (!string.IsNullOrEmpty(permissions)) { // A comma-delimited list of permissions parameters["scope"] = permissions; } var client = new FacebookClient(); return client.GetLoginUrl(parameters); }