javascript - How facebook auth by js? -
I need apps where a user can login & amp; Some information will be shown after being recorded but I have to face many problems many times, please help me improve it. SOmetime shows FB unrecognized, sometimes showing GET file: //connect.facebook.net/en_US/all.js net :: ERR_FILE_NOT_FOUND.
& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Facebook & lt; / Title & gt; & Lt; Script src = "jquery.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; A href = "#" onClick = "FB.getLoginStatus ()" & gt; Login & lt; / A & gt; & Lt; Script & gt; // Additional JS function here window.fbAsyncInit = function () {FB.init ({appId: 'xxxxxxxx', // app ID status: true, // check login status cookie: true, // allow server Enable cookies to access the session xfbml: true // parse XFBML}); // Additional init code here FB.getLoginStatus {function (response) {if (response.status === 'connect') {// connect} and if (response.status === 'not_authorized') {// not_authorized login ();} Other {// not_logged_in login ();}}};}; function login () {FB.login (function) {if (response.authResponse) {testAPI ();} else {// cancellation }}}} Function testAPI () {console.log ('Welcome! Getting your information ...'); FBP ('/ m', function (feedback) {console.log (' Good to see you, '+ response.name +'. ');}); // Load asynchronous SDK to SDK (Function (d) {var js, id = 'facebook-jssdk', ref = d.getElementsByTagName ('script') [0]; if (d.getElementById (id)) {return;} JS = D.Socket element ('Script'); J.ID = ID; JSACNC = true; JSCRC = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore (js, referee);} (document)) ; & Lt; / script & gt; & lt; / body & gt; & lt; / html & gt;
Add to the http: // front. I think this is necessary.
Comments
Post a Comment