fullstackreact / react-native-oauth

A react-native wrapper for social authentication login for both Android and iOS
https://fullstackreact.com
MIT License
801 stars 214 forks source link

[Android] App crashes logging in with GitHub #159

Open desktp opened 7 years ago

desktp commented 7 years ago

App crashes with no errors messages in either Chrome console or react-native log-android. It goes as far as the GitHub login screen, and crashes on going back to the app.

Versions: react-native: 0.48.1 react-native-oauth: ^2.2.0

Code:

export default class AuthScreen extends Component {
  componentWillMount() {
    const config = {
      github: {
        callback_url: `http://localhost/github`,
        client_id: '',
        client_secret: ''
      }
    }

    this.manager = new OAuthManager('gistreader')

    this.manager.configure(config);
    // console.log(this.manager);
  }

  login() {
    console.log('login');
    this.manager.authorize('github', {scopes: 'user:email gist'})
      .then((res) => {
        console.log('success');
        console.log(res);
      })
      .catch(err => console.log(err));
  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Auth Screen!
        </Text>
        <Text style={styles.welcome}>

        </Text>
        <Button
          title='Login with Github'
          onPress={() => this.login()}
        />
        <Button 
          title='To Reader >'
          onPress={() => this.props.navigation.navigate('Reader')}
        />
      </View>
    );
  }
}

Thanks in advance.

desktp commented 7 years ago

The changes in #121 fixes this problem. Any plans on merging that?