public GetLoginUrl ( object parameters ) : |
||
parameters | object | /// The parameters. /// |
return |
public ActionResult Facebook() { var fb = new FacebookClient(); Uri loginUrl; if (Request.Url.AbsoluteUri == "http://localhost:53624/Account/Facebook") { loginUrl = fb.GetLoginUrl(new { client_id = "210504125641177", client_secret = "d417ef6d72b9cdb430f938eb19c1b929", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "user_birthday, email" }); } else { loginUrl = fb.GetLoginUrl(new { client_id = "118326544910444", client_secret = "d2f09ce5b35cd32352d295be5df2ba39", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "user_birthday, email" }); } return Redirect(loginUrl.AbsoluteUri); }
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 }
private void button1_Click(object sender, RibbonControlEventArgs e) { if (ThisAddIn.GetAccessToken() == "") { try { FacebookClient fc = new FacebookClient(); LoginForm l = new LoginForm(fc.GetLoginUrl(new { client_id = ThisAddIn._appkey, response_type = "token", display = "touch", redirect_uri = "https://www.facebook.com/connect/login_success.html", scope = String.Join(",", PERMISSIONS) }).ToString(), this, true); l.Show(); } catch (Exception ex) { } } else { var fb = new FacebookClient(ThisAddIn.GetAccessToken()); dynamic me = fb.Get("me"); var url = me.link; Process.Start(url); } }
public FacebookLoginPage() { // NOTE: make sure to enable scripting for the web browser control. // <phone:WebBrowser x:Name="webBrowser1" IsScriptEnabled="True" /> var fb = new FacebookClient(); var loginParameters = new Dictionary<string, object>(); loginParameters["client_id"] = AppId; loginParameters["redirect_uri"] = RedirectUri; // The requested response: an access token (token), an authorization code (code), or both (code token). // note: there is a bug in wpf browser control which ignores the fragment part (#) of the url // so we cannot get the access token. To fix this, set response_type to code as code is set in // the querystring. loginParameters["response_type"] = "code"; // 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. _loginUrl = fb.GetLoginUrl(loginParameters); InitializeComponent(); }
public ActionResult Connect(string returnUrl) { // TODO: Rebuild functionality using CoffeeScript implementation and new C# API var fb = new FacebookClient(); var loginUri = fb.GetLoginUrl(new { state = returnUrl }); return Redirect(loginUri.AbsoluteUri); }
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; } }
private Uri GenerateLoginUrl(string appId, string extendedPermissions) { 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 Facebook.FacebookClient(); return(fb.GetLoginUrl(parameters)); }
private async Task<string> Facebook() { 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) { throw; } }
public FacebookLoginDialog(string appId, string extendedPermissions) { if (string.IsNullOrEmpty(appId)) throw new ArgumentNullException("appId"); var fb = new FacebookClient(); 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. _loginUrl = fb.GetLoginUrl(loginParameters); InitializeComponent(); }
public void Login() { dynamic parameters = new ExpandoObject(); parameters.client_id = "781659158605315"; parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; parameters.response_type = "token"; parameters.display = "popup"; var fb = new FacebookClient(); Uri loginUrl = fb.GetLoginUrl(parameters); var urlWithScope = loginUrl.AbsoluteUri + "&scope=user_friends"; webBrowserLogin.Navigate(urlWithScope); }
public ActionResult Facebook() { Facebook.FacebookClient fb = new Facebook.FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "<Your application ID>", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email,publish_actions,user_posts,publish_pages,manage_pages,user_likes" }); return(Redirect(loginUrl.AbsoluteUri)); }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "769429839779017", client_secret = "910688593eef875bfca0e70767032c0d", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" }); return Redirect(loginUrl.AbsoluteUri); }
// GET: /Account/ public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "100106430186046", client_secret = "7c9ee3c7e3a1362098ad88b7a9227fc8", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public string GenerateLoginUrl() { dynamic parameters = new ExpandoObject(); parameters.client_id = ApplicationId; parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html"; parameters.response_type = "token"; parameters.display = "popup"; fb = new FacebookClient(); Uri loginUri = fb.GetLoginUrl(parameters); return loginUri.AbsoluteUri; }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "410278782401754", client_secret = "4d0fd841a025dd908191f50b86ec90f7", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "1539813469663309", client_secret = "0883fd6699f9f387a575e12d28391751", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email,rsvp_event,user_likes,user_birthday, user_friends" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "462931197153588", client_secret = "82c4ec01d4516d06889341aed8857e5b", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "643310709067274", client_secret = "15c2fca2d83cac4f2d4cc116ae6eeadf", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "887117078046213", client_secret = "d27adbc1c24cffa0fb4849592a3befd9", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); //return View(); }
// // GET: /Facebook/ public ActionResult Index() { if (Session["AccessToken"] != null && !string.IsNullOrEmpty(Session["AccessToken"].ToString())) return RedirectToAction("Home"); var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = ConsumerKey, client_secret = ConsumerSecret, redirect_uri = "http://userprofiler.azurewebsites.net/facebook/Callback", response_type = "code", scope = "email" }); return Redirect(loginUrl.AbsoluteUri); }
public ActionResult AuthenFacebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = ConfigurationManager.AppSettings["clientId"], //"412367302292593", client_secret = ConfigurationManager.AppSettings["clientSecret"], //"95b9b97174f94bbff3bdff437e520cc7", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email,user_birthday,user_about_me,user_website" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public static void loginToFacebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "1734189983463496", redirect_uri = "https://localhost:44300/home/redirect", response_type = "code", scope = "email,user_likes,publish_actions,manage_pages, publish_pages" // Add other permissions as needed }); HttpContext.Current.Response.Redirect(loginUrl.AbsoluteUri); // User not connected, ask them to sign in again }
protected void Button1_Click(object sender, EventArgs e) { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "your_app_id", redirect_uri = "http://localhost:8779/FacebookDemo.aspx", response_type = "code", scope = "email" // Add other permissions as needed }); Response.Redirect(loginUrl.AbsoluteUri); }
public ActionResult Facebook() { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { // Production : client_id = "410278782401754", client_secret = "4d0fd841a025dd908191f50b86ec90f7", // Development : //client_id = "424967934259582", //client_secret = "7d491f9e46f04614240c0043094fd2d5", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" // Add other permissions as needed }); return Redirect(loginUrl.AbsoluteUri); }
public ActionResult Facebook() { try { var fb = new Facebook.FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = "", client_secret = "", redirect_uri = RedirectUri.AbsoluteUri, response_type = "code", scope = "email" }); return(Redirect(loginUrl.AbsoluteUri)); } catch { } return(View("Index")); }
private Uri GetFacebookLoginUrl(string appId, string extendedPermissions) { var parameters = new Dictionary <string, object>(); parameters["client_id"] = EndpointHelper.FacebookAppId; parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; parameters["response_type"] = "token"; parameters["display"] = "touch"; // add the 'scope' only if we have extendedPermissions. if (!string.IsNullOrEmpty(extendedPermissions)) { // A comma-delimited list of permissions parameters["scope"] = extendedPermissions; } return(client.GetLoginUrl(parameters)); }
public Uri getLoginURL() { dynamic parameters = new System.Dynamic.ExpandoObject(); parameters.client_id = m_APP_ID; parameters.redirect_uri = m_SUCCESS_URI; // 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. string extendedPermissions = "read_mailbox"; parameters.scope = extendedPermissions; // generate the login url dynamic token = null; Facebook.FacebookClient FBClient = new Facebook.FacebookClient(); try { token = FBClient.Get("oauth/access_token", new { client_id = m_APP_ID, // "1465357507096514" client_secret = m_APP_SECRET, // "ac5817c4f2dd07bf18137d7297d4015c" grant_type = "client_credentials" }); } catch (WebExceptionWrapper) { ErrorMessages.WebConnectionFailure(); return(null); } FBClient.AccessToken = token.access_token; FBClient.AppId = m_APP_ID; FBClient.AppSecret = m_APP_SECRET; return(FBClient.GetLoginUrl(parameters)); }
public ActionResult Login() { dynamic parameters = new ExpandoObject(); parameters.client_id = ConfigurationManager.AppSettings["FacebookAppId"]; parameters.redirect_uri = "http://localhost:2780/home/LoginRetorno"; parameters.response_type = "code"; parameters.display = "popup"; var extendedPermissions = "user_about_me,read_stream,publish_stream"; if (!string.IsNullOrWhiteSpace(extendedPermissions)) parameters.scope = extendedPermissions; var fb = new FacebookClient(); var url = fb.GetLoginUrl(parameters); return Redirect(url.ToString()); }
private void faceBookLogin() { dynamic parameters = new ExpandoObject(); 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; } var fb = new FacebookClient(); _LoginUrl = fb.GetLoginUrl(parameters); this.webBrowser1.Navigate(_LoginUrl.AbsoluteUri); }
private Uri GenerateLoginUrl(string appId, string extendedPermissions) { 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); }
protected void cmd_fb_login_Click(object sender, EventArgs e) { var fb = new FacebookClient(); var loginUrl = fb.GetLoginUrl(new { client_id = ConfigurationManager.AppSettings["fb.appid"].ToString(), redirect_uri = "http://mp.makhdumi.net/FacebookAuth.aspx", response_type = "code", scope = "public_profile,email,user_posts,user_photos" }); Response.Redirect(loginUrl.AbsoluteUri); //var fb = new FacebookClient(); //fb.AccessToken = "CAAHCf5OoIDwBACoXn3tMjKc4h8SUmbZCZA2sZCgZCNMxPMu43NgE6iPB6E8GHZCgI9aXkkZBW62NZBHTqoWfAdeEtJT56EuncbGEl4gV3mZCieQRKX7UHgR3zV0QNlD7PIG0hBXxjN5WSw03RPkBXKuDAXvkz4KZAgH60ZCJsincrH08kHwn1LD0xIEWAs866K0hwo2RfY2jQlIj7IZBegdaC6F"; //dynamic me = fb.Get("/me"); //if (me == null) // appendlog("me is null"); //appendlog("me init : " + me.Count.ToString()); }
/// <summary> /// Constructor for FacebookLoginDialog. /// </summary> public FacebookLoginDialog() { InitializeComponent(); // The facebook login page may have problem with script debugging. Disable script debugging for the browser. WebBrowser.ScriptErrorsSuppressed = true; // Check that facebook application Id has been specified. // Please remove this check when the facebook application Id has been specified. if (FacebookApplicationId.StartsWith("Enter")) { MessageBox.Show("Please specify your facebook application Id in FacebookLoginDialog.cs before compiling and running the QvFacebookConnector!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new Exception("Please specify your facebook application Id in FacebookLoginDialog.cs before compiling and running the QvFacebookConnector!"); } // Create the login parameters. var loginParameters = new Dictionary<string, object> { { "client_id", FacebookApplicationId }, { "redirect_uri", "https://www.facebook.com/connect/login_success.html" }, { "response_type", "token" }, { "display", "popup" } }; var permissionsStrings = Enum.GetNames(typeof(FacebookPermissions)); if (permissionsStrings.Length > 0) { var scope = new StringBuilder(); scope.Append(string.Join(",", permissionsStrings)); loginParameters["scope"] = scope.ToString(); } _facebookClient = new FacebookClient(); _loginUrl = _facebookClient.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()); }
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 RedirectResult GetFacebookLoginURL() { if (Session["AccessTokenRetryCount"] == null || (Session["AccessTokenRetryCount"] != null && Session["AccessTokenRetryCount"].ToString() == "0")) { Session.Add("AccessTokenRetryCount", "1"); FacebookClient fb = new FacebookClient(); fb.AppId = AppConfiguration.Facebook_AppID; return Redirect(fb.GetLoginUrl(new { scope = AppConfiguration.Facebook_Scope, redirect_uri = RedirectUri.AbsoluteUri, response_type = "code" }).ToString()); } else { ViewBag.ErrorMessage = "Unable to obtain a valid Facebook Token, contact support"; return Redirect(Url.Action("Index", "Error")); } }