React NativeでFirebase Twitter認証を使用するには?
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.
}
});
}
});
と
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);
}
});
}
});
を使用するauthWithOAuthRedirect
と、次のようなエラーが発生しました
undefined is not an object (evaluating 'window.location.href')
を使用するauthWithOAuthPopup
と、何も起こりませんでした。
どうすれば質問を解決できますか? それとも無理ですか?