Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook login need any access key to be configured somewhere? #16

Open
tejasspublishers opened this issue Apr 25, 2019 · 2 comments
Open

Comments

@tejasspublishers
Copy link

No description provided.

@rahu431
Copy link

rahu431 commented Apr 25, 2019

I like your starter kit its super cool and if you can update or guide us on update this starter kit, it will be perfect and useful.
facebook login not working for me too.

@chazkondo
Copy link

For people who just want to bypass the facebook login to learn more about the app, just replace the code in /src/screens/LoginScreen/LoginScreen.js with:

// @flow

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import {
  StyleSheet,
  View,
  Alert
} from 'react-native';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import { LoginManager, AccessToken } from 'react-native-fbsdk';

import { connectData } from 'src/redux';
import { pushSingleScreenApp, pushTabBasedApp } from 'src/navigation';

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

class LoginScreen extends PureComponent {

  loginWithFacebook = () => {
    const { 
      // getFacebookUserData, 
      screenType 
    } = this.props;

    if (screenType === 'Single') {
      pushSingleScreenApp();
    } else {
      pushTabBasedApp();
    }
  }

  //   LoginManager
  //     .logInWithReadPermissions(['public_profile', 'email'])
  //     .then((result) => {
  //       if (result.isCancelled) {
  //         return Promise.reject('Facebook login cancelled.');
  //       }
  //       return AccessToken.getCurrentAccessToken();
  //     })
  //     .then((data) => {
  //       if (!data.accessToken) {
  //         getFacebookUserData({ facebookToken: data.accessToken });
  //         if (screenType === 'Single') {
  //           pushSingleScreenApp();
  //         } else {
  //           pushTabBasedApp();
  //         }
  //       } else {
  //         Alert.alert('ReactNativeStarterKit', 'Failed to get facebook access token.');
  //       }
  //     })
  //     .catch(() => Alert.alert('ReactNativeStarterKit', 'Something went wrong.'));
  // };

  render() {
    return (
      <View style={styles.flex}>
        <FontAwesome5.Button
          solid
          name={'facebook'}
          style={styles.button}
          onPress={this.loginWithFacebook}
        >
          Login with Facebook
        </FontAwesome5.Button>
      </View>
    );
  }
}

LoginScreen.propTypes = {
  getFacebookUserData: PropTypes.func.isRequired,
  screenType: PropTypes.oneOf(['Single', 'Tab']).isRequired
};

export default connectData()(LoginScreen);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants