当前位置: 首页>>代码示例>>C#>>正文


C# FacebookClient.GetLoginUrl方法代码示例

本文整理汇总了C#中Facebook.FacebookClient.GetLoginUrl方法的典型用法代码示例。如果您正苦于以下问题:C# FacebookClient.GetLoginUrl方法的具体用法?C# FacebookClient.GetLoginUrl怎么用?C# FacebookClient.GetLoginUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facebook.FacebookClient的用法示例。


在下文中一共展示了FacebookClient.GetLoginUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Facebook

        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);
        }
开发者ID:petermunnings,项目名称:funwithoiky,代码行数:30,代码来源:AccountController.cs

示例2: Login

        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

        }
开发者ID:duongnhyt,项目名称:FacebookSample-Universal,代码行数:30,代码来源:MainPage.xaml.cs

示例3: button1_Click

 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);
     }
 }
开发者ID:ly2314,项目名称:PowerPointFacebookAPI,代码行数:29,代码来源:Ribbon.cs

示例4: FacebookLoginDialog

        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();
        }
开发者ID:bertvan,项目名称:facebook-csharp-sdk,代码行数:30,代码来源:FacebookLoginDialog.cs

示例5: AuthenticateFacebookAsync

    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;
      }
    }
开发者ID:LocalJoost,项目名称:CustomFacebookoAuthLogin,代码行数:26,代码来源:MainPage.xaml.cs

示例6: Connect

 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);
 }
开发者ID:JordanRift,项目名称:Grassroots,代码行数:7,代码来源:FacebookController.cs

示例7: Facebook

        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;
            }
        }
开发者ID:wouterDumon,项目名称:AppDevWindows-Gardnr,代码行数:32,代码来源:LoginVM.cs

示例8: FacebookLoginPage

        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();
        }
开发者ID:bertvan,项目名称:facebook-csharp-sdk,代码行数:30,代码来源:FacebookLoginPage.xaml.cs

示例9: Login

 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);
 }
开发者ID:Kubabanka,项目名称:TSST.Client,代码行数:12,代码来源:LoginForm.cs

示例10: Facebook

        // 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);
        }
开发者ID:alivanov,项目名称:Facebook_Auth,代码行数:14,代码来源:AccountController.cs

示例11: Facebook

 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);
 }
开发者ID:hathanhthanh,项目名称:ListWebSiteOfVietNam,代码行数:13,代码来源:LoginGuestController.cs

示例12: GenerateLoginUrl

        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;
        }
开发者ID:kzinti,项目名称:MaxClique,代码行数:14,代码来源:FacebookConnection.cs

示例13: Facebook

        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);
        }
开发者ID:tep-pl,项目名称:Radar,代码行数:14,代码来源:AccountController.cs

示例14: AuthenFacebook

        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);
        }
开发者ID:sangnvus,项目名称:2015FALLJS01,代码行数:17,代码来源:LoginController.cs

示例15: Index

        //
        // 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);
        }
开发者ID:travipl2015,项目名称:UserProfiler,代码行数:19,代码来源:FacebookController.cs


注:本文中的Facebook.FacebookClient.GetLoginUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。