Ich versuche eine einfache Web-App mit facebook-auth für das Login und die Autorisierung mit react-facebook-login aus dem npmjs-Paket zu reagieren, aber sie wird immer von einem Popup-Blocker geblockt. Mein Code ist also:Wie kann ich das Facebook-Login-Popup deaktivieren?
static defaultProps = {
textButton: 'Login with Facebook',
scope: 'public_profile, email',
xfbml: false,
cookie: false,
size: 'metro',
fields: 'name',
cssClass: 'kep-login-facebook',
version: '2.3',
language: 'en_US',
uri: encodeURI('http://myapps.com');
};
document.body.appendChild(fbRoot);
window.fbAsyncInit =() => {
FB.init({
appId: this.props.appId,
xfbml: this.props.xfbml,
cookie: this.props.cookie,
version: 'v' + this.props.version,
});
if (this.props.autoLoad) {
FB.getLoginStatus(this.checkLoginState);
}
};
((d, s, id) => {
const element = d.getElementsByTagName(s)[0];
const fjs = element;
let js = element;
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = '//connect.facebook.net/' + this.props.language + '/all.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
responseApi = (authResponse) => {
FB.api('/me', { fields: this.props.fields }, (me) => {
Object.assign(me, authResponse)
this.props.callback(me);
});
};
checkLoginState = (response) => {
if (response.authResponse) {
this.responseApi(response.authResponse);
} else {
if (this.props.callback) {
this.props.callback({ status: response.status });
}
}
};
click =() => {
FB.login(this.checkLoginState, { scope: this.props.scope });
};
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
wo genau sind Sie ein "reagieren-Facebook-Login" Plugin? sieht wie grundlegendes js sdk zu mir aus. oder ist das eigentlich der Code des Plugins? Was wichtig ist, ist dann dein Code. – luschn
oder so, es gibt nur einen Grund, warum ich weiß, warum Browser die Anmeldung blockieren würde, überprüfen Sie meine Antwort. – luschn