facebook js sdk acting differently with fb.login() -
trying connect facebook via js sdk asp.net.
this.initfacebookapi = function () { var dfd = $.deferred(); (function (d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) { dfd.resolve(); return; } js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); dfd.resolve(); }(document, 'script', 'facebook-jssdk')); return dfd.promise(); }; this.checkconnection = function (verifyconnection) { var appid = _this.viewmodel.appid(); fb.init({ appid: appid, xfbml: true, version: 'v2.9' }); fb.login(function (response) { // handle response console.log('logged in facebook.', response); if (response.authresponse == null || response.authresponse.grantedscopes == null) { toastr.error("user must approve requested permissions"); $("#progressspinner").hide(); return; } var curmodeluserid = _this.viewmodel.userid(); if (curmodeluserid != null && curmodeluserid != response.authresponse.userid) { var url = "https://www.facebook.com/logout.php?next=" + _this.viewmodel.redirecturi() + "&access_token=" + response.authresponse.accesstoken; window.open(url); //toastr.warning("please logout logged in facebook user account"); //$("#progressspinner").hide(); settimeout(function () { _this.checkconnection(verifyconnection); }, 3000); return; } //save user id _this.viewmodel.userid(response.authresponse.userid); var permissionsarr = response.authresponse.grantedscopes.split(","); var grantedpermissions = []; (var = 0; < permissionsarr.length; i++) { var item = permissionsarr[i]; grantedpermissions.push(item); } console.log("granted permissions: " + grantedpermissions); var found = false; (var = 0; < grantedpermissions.length; i++) { var permissionstr = grantedpermissions[i]; if (permissionstr == "user_posts") { found = true; break; } } if (!found) { toastr.error("user must approve requested permissions"); $("#progressspinner").hide(); } else { _this.facebooklogincalled = true; if (verifyconnection) { _this.verifyconnection(); } else { $("#progressspinner").hide(); } } }, { scope: 'user_posts,email', auth_type: 'rerequest', return_scopes: true, enable_profile_selector: true }); };
when running in web browser get: "getting authenticate site that's supposed be"
but when run website via winform (in chromium) get: "not logged in: not logged in. please login , try again."
how authenticate window i'm getting when running through web browser?
Comments
Post a Comment