我想在我的反應原生應用程序中使用Facebook登錄..我使用web上的firebase(reactJs)..現在我使用相同的方法來反應原生應用程序,但它不工作.. 。如何使用Facebook登錄反應本機應用程序
我想fbSignin按鈕,允許我使用用戶的個人資料相片和姓名等。
這裏是我的代碼..
import React, { Component } from "react"
import { Container, Item, Button, Text } from "native-base"
import * as firebase from "firebase"
import { FBLogin, FBLoginManager } from "react-native-facebook-login"
// Initialize Firebase
var config = {
apiKey: "AIzaSyAK7dr25d-qnsHCdvkeoVPWs7Q0",
authDomain: "quiz-appasdn-ba8c1.firebaseapp.com",
databaseURL: "httpsasdasdasdasd-ba8c1.firebaseio.com",
projectId: "quiz-asdaasdasdc1",
storageBucket: "pplicationasdasd-asddappspot.com",
messagingSenderId: "23764257465237"
};
firebase.initializeApp(config);
var provider = new firebase.auth.FacebookAuthProvider();
class App extends Component {
fbLogin() {
firebase.auth().signInWithPopup(provider).then(function (result) {
var token = result.credential.accessToken;
var user = result.user;
}).catch(function (error) {
var errorCode = error.code;
var errorMessage = error.message;
var email = error.email;
var credential = error.credential;
});
}
render() {
return (
<Button onPress={this.fbLogin.bind(this)}>
<Text>faacebook Login</Text>
</Button>
);
}
};
出口默認應用
感謝提前..
請從帖子中刪除API密鑰 – XPLOT1ON