3

指数を使用しており、認証のためにExponent.Facebook.logInWithReadPermissionsAsyncにアクセスしているヘルプが必要です。誰でもプロジェクトを設定するためのガイドがあります。私はiOSフォルダを見つけることができません。なぜなら、facebook sdkの指示では、プロジェクトにライブラリをほとんど追加する必要がないからです。ここに私のmain.jsです:Exponent React Nativeを使用したFacebookログイン

import Expo from 'expo'; 
import React from 'react'; 
import { StyleSheet, Text, View } from 'react-native'; 
import { Button } from 'react-native-elements'; 

class App extends React.Component { 

    authenticate = (token) => { 
    const provider = firebase.auth.FacebookAuthProvider; 
    const credential = provider.credential(token); 
    return firebase.auth().signInWithCredential(credential); 
    } 

    login = async() => { 
    const ADD_ID = 273131576444313 
    const options = { 
     permissions: ['public_profile', 'email'], 
    } 
    const {type, token} = await Expo.Facebook.logInWithReadPermissionsAsync(ADD_ID, options) 
    if (type === 'success') { 
     const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`) 
     console.log(await response.json()); 
     this.authenticate(token); 
    } 
} 

    render() { 
    return (
     <View style={styles.container}> 
     <Text>Open up main.js to start working on your app!</Text> 
     <Button 
      raised 
      onPress={this.login} 
      icon={{name: 'cached'}} 
      title='RAISED WITH ICON' /> 
     </View> 
    ); 
    } 

} 

const styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    backgroundColor: '#fff', 
    alignItems: 'center', 
    justifyContent: 'center', 
    }, 
}); 

Expo.registerRootComponent(App); 

`

答えて

2

APP_ID周りの単一引用符を入れて、それが動作するようになりまし

+0

感謝を試してみてください..:Dあなたは乱数にアプリのIDを編集したい場合があります –

+1

BTW。 –

+0

@RuiePena 'expo sdk'のこのコード以外に取った他のステップは?私はこのエラー '無効なキーハッシュを取得しています。キーハッシュ83490ksksjklsjjskj =は、格納されているキーハッシュと一致しません...... " –

関連する問題