Come utilizzare l'autenticazione Twitter Firebase con React Native?Come utilizzare l'autenticazione Twitter Firebase con React Native?
ho provato sia il codice di seguito in riferimento alle https://www.firebase.com/docs/web/guide/login/twitter.html
var Firebase = require("firebase");
var App = React.createClass({
render: function() {
return (
<View>
<Text onPress={this._handlePress}>
Twitter login
</Text>
</View>
);
},
_handlePress: function() {
var myApp = new Firebase("https://<myapp>.firebaseio.com");
myApp.authWithOAuthRedirect("twitter", function(error) {
if (error) {
console.log("Login Failed!", error);
} else {
// We'll never get here, as the page will redirect on success.
}
});
}
});
e
var Firebase = require("firebase");
var App = React.createClass({
render: function() {
return (
<View>
<Text onPress={this._handlePress}>
Twitter login
</Text>
</View>
);
},
_handlePress: function() {
var myApp = new Firebase("https://<myapp>.firebaseio.com");
myApp.authWithOAuthPopup("twitter", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
}
});
}
});
Quando uso authWithOAuthRedirect
, un errore si è verificato come
undefined is not an object (evaluating 'window.location.href')
Quando uso authWithOAuthPopup
, non è successo niente.
Come posso risolvere la domanda? Oppure non è possibile?
A quest'ultimo punto, un buon punto di partenza potrebbe essere la demo di accesso Firebase per iOS: https://github.com/firebase/login-demo-ios Ma non sarà per il debole nel cuore. –
Grazie per il vostro aiuto. Ho smesso di usare React Native e ho provato ad usare Ionic. – okmttdhr
@FrankvanPuffelen Questo vale per l'autenticazione Email/PW anche su React Native con Firebase? –