c# - asp.net integrate facebook login -
hi using facebook login authenticate in local application.but @ last when click on facebook image shows error:
given url not allowed application configuration.: 1 or more of given urls not allowed app's settings. must match website url or canvas url, or domain must subdomain of 1 of app's domains.
i know domain name error have set in facebook aap url , site url.
i have set same url in iis , facebook app .still got error.
here code:
<html> <head> <title>facebook login authentication example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <script> // load sdk asynchronously (function (d) { var js, id = 'facebook-jssdk', ref = d.getelementsbytagname('script')[0]; if (d.getelementbyid(id)) { return; } js = d.createelement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_us/all.js"; ref.parentnode.insertbefore(js, ref); } (document)); // init sdk upon load window.fbasyncinit = function () { fb.init({ appid: '553530488015828', // app id channelurl: '//' + window.location.hostname + '/channel', // path channel file status: true, // check login status cookie: true, // enable cookies allow server access session xfbml: true // parse xfbml }); // listen , handle auth.statuschange events fb.event.subscribe('auth.statuschange', function (response) { if (response.authresponse) { // user has auth'd app , logged facebook fb.api('/me', function (me) { if (me.name) { document.getelementbyid('auth-displayname').innerhtml = me.name; } }) document.getelementbyid('auth-loggedout').style.display = 'none'; document.getelementbyid('auth-loggedin').style.display = 'block'; } else { // user has not auth'd app, or not logged facebook document.getelementbyid('auth-loggedout').style.display = 'block'; document.getelementbyid('auth-loggedin').style.display = 'none'; } }); $("#auth-logoutlink").click(function () { fb.logout(function () { window.location.reload(); }); }); } </script> <h1> facebook login authentication example</h1> <div id="auth-status"> <div id="auth-loggedout"> <div class="fb-login-button" autologoutlink="true" scope="email,user_checkins">login facebook</div> </div> <div id="auth-loggedin" style="display: none"> hi, <span id="auth-displayname"></span>(<a href="#" id="auth-logoutlink">logout</a>) </div> </div> </body>
you need add unique facebook app id use facebook login authenticate in localhost. , need specify url in https://developers.facebook.com/
Comments
Post a Comment