Facebook Login per GdR?
Facebook Login per GdR? postato il 06/11/2015 10:23:35 nel forum programmazione, open source e hosting e modificato da gdr-online.com il 06/11/2015 14:33:17
Salve,
Qualcuno è in grado di integrare alla registrazione di gdr a quella di facebook ?
Grazie
Pagine → 1
06/11/2015 10:31:00
https://developers.facebook.com/docs/facebook-login https://developers.facebook.com/docs/facebook-login ↗
Rifatti alla documentazione ufficiale, facebook ha il brutto vizio di cambiare API da un giorno all'altro senza avvisare. E lo fa spesso.
06/11/2015 10:52:24
ci sto tentando son sincero, però non è cosi semplice come sembrava
06/11/2015 10:57:28
giusto per curiosità. Sto dando una occhiata alle web api sdk in php, ma trovo solo i nomi delle classi, senza alcuna lista di proprietà e metodi. Purtroppo di protocolli web me ne intendo attualmente poco, quindi non so di preciso come funziona OAuth, sse magari potessi spiegare anche come funziona l'interazione con la Web Graph api, sarebbe meglio pure per l'utente in questione
06/11/2015 11:19:39
effettivamente ho guardato ma non capisco svariate cose.
06/11/2015 11:26:47
comunque presupponendo che stai chiedendo aiuto per un gdr...a che ti serve collegare il login con l'account facebook? Apparte che dubito chi gioca ad un pbc si senta tanto ben disposto a sputtanarsi la sua privacy, specie con il fumere che si vede ogni giorno nell mondo delle land...ma in ogni caso se ci dici in dettaglio cosa ti serve cosa vuoi fare, perchè le vuoi fare e che codice stai usando, ci verrà più facile trovarti una soluzione, eh?
06/11/2015 11:34:13
più che altro non credo proprio che il GDRCD o altri opensource siano progettati per accogliere anche account da facebook o altri social...
06/11/2015 15:04:14
Non siano programmati ? in realtà mi serve per un account visitatore predisposto per determinate funzioni( solo di visione ) diciamo che è tipo una demo ma non vado nel dettaglio.
Comunque l'account in questione serve email e nome( che combacia perfettamente con la richiesta di fb se non sbaglio), oltretutto non sarà visibile nessun profilo semplicemente potrà guardare la land .
comunque leggendo ho iniziato col codice che danno quindi :
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<script>
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
// Logged into your app and Facebook.
testAPI();
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
document.getElementById('status').innerHTML = 'Please log ' +
'into Facebook.';
}
}
// This function is called when someone finishes with the Login
// Button. See the onlogin handler attached to it in the sample
// code below.
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
window.fbAsyncInit = function() {
FB.init({
appId : '{your-app-id}',
cookie : true, // enable cookies to allow the server to access
// the session
xfbml : true, // parse social plugins on this page
version : 'v2.2' // use version 2.2
});
// Now that we've initialized the JavaScript SDK, we call
// FB.getLoginStatus(). This function gets the state of the
// person visiting this page and can return one of three states to
// the callback you provide. They can be:
//
// 1. Logged into your app ('connected')
// 2. Logged into Facebook, but not your app ('not_authorized')
// 3. Not logged into Facebook and can't tell if they are logged into
// your app or not.
//
// These three cases are handled in the callback function.
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
// Load the SDK asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Here we run a very simple test of the Graph API after login is
// successful. See statusChangeCallback() for when this call is made.
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
});
}
</script>
<!--
Below we include the Login Button social plugin. This button uses
the JavaScript SDK to present a graphical Login button that triggers
the FB.login() function when clicked.
-->
<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>
<div id="status">
</div>
</body>
</html>
Ho messo app-id, ho aperto la consol di google e ho fatto il test appare il messaggio quindi tutto apposto.
Però forse anche per il mio non perfetto inglese, non riesco ad intuire i passaggi dopo.
Se qualcuno ne ha voglia e riesce ad aiutarmi gliene sarei grato.
07/11/2015 13:54:59
Ascolta quella funzione fa l'esatto opposto di quello che vorresti fare tu. Serve per loggare su facebook dalla tua land, non viceversa. Tipo se hai una pagina ufficiale del tuo gioco, in questo modo puoi gestirla direttamente dal tuo gdr, invece di loggare su fb. Ma il cotnrario non credo sia possibile e nonc redo che zuckenburg permetterebbe al primo pinco pallino di fare i cavoli propri sul db della sua azienda(perchè per verificare che un account di facebook che il visitatore inserisce da te, l'unica è fare una query sul db di facebook stesso...e sarebbe pirateria informatica se anche ci riuscissi.)
08/11/2015 22:38:32
Il codice che ha riportato sopra è quello che permette di mettere il bottoncino "Login con FB" sulla pagina.
Quando viene cliccato, viene fatta una lettura dei dati su facebook. Questo non significa che vai a leggere i dati sul db di facebook. Ma in pratica (Sempre che tu sia loggato effettivamente su fb) va a leggere i dati dell'account attivo. Previa richiesta del consenso.
Poi li usera immagino per fare il login nella sua land.
27/11/2015 10:44:10 e modificato da pamela4e il 27/11/2015 10:44:29
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<script>
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
// Logged into your app and Facebook.
testAPI();
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
document.getElementById('status').innerHTML = 'Please log ' +
'into Facebook.';
}
}
// This function is called when someone finishes with the Login
// Button. See the onlogin handler attached to it in the sample
// code below.
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
window.fbAsyncInit = function() {
FB.init({
appId : '{your-app-id}',
cookie : true, // enable cookies to allow the server to access
// the session
xfbml : true, // parse social plugins on this page
version : 'v2.2' // use version 2.2
});
// Now that we've initialized the JavaScript SDK, we call
// FB.getLoginStatus(). This function gets the state of the
// person visiting this page and can return one of three states to
// the callback you provide. They can be:
//
// 1. Logged into your app ('connected')
// 2. Logged into Facebook, but not your app ('not_authorized')
// 3. Not logged into Facebook and can't tell if they are logged into
// your app or not.
//
// These three cases are handled in the callback function.
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
// Load the SDK asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Here we run a very simple test of the Graph API after login is
// successful. See statusChangeCallback() for when this call is made.
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
});
}
</script>
<!--
Below we include the Login Button social plugin. This button uses
the JavaScript SDK to present a graphical Login button that triggers
the FB.login() function when clicked.
-->
<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>
<div id="status">
</div>
</body>
</html>
questo è il codice lasciato da fb a questo https://developers.facebook.com/docs/facebook-login/web ↗
certo però non capisco come collegarlo poi a me, o comunque attingere ai dati nome e email.
Discussione seguita da
Pagine → 1
Rispondi alla Discussione Segui Discussione Inoltra Discussione Forum Programmazione, Open Source e Hosting Elenco Forum
Articoli, Interviste e altre Risorse!
World of Warship ↗
Sea of Conquest ↗
Enlisted ↗
Cafuné ↗
Project Entropy ↗
RAID Shadow Legends ↗
Exclusive Villa GdR ↗
Imperion ↗
World of the Sea Battle ↗