Google вход в expo v32 документация отсутствует код? - PullRequest
0 голосов
/ 12 февраля 2019

Я в основном слежу за документацией, чтобы внедрить ее в мое приложение, однако, это дает мне эту ошибку.Я установил их демо, и он также вышел с той же ошибкой

screenshot of error

Я искал в интернете и до сих пор не нашел ничего, связанного с этой проблемой

    import React, { Component } from 'react';
    import { View, Text, Platform, ScrollView, Linking } from 'react-native';
    import { Button, Card, Icon } from 'react-native-elements';
    import { connect } from 'react-redux';
    import {Actions} from 'react-native-router-flux';
    import * as actions from '../actions';
    import { GoogleSignIn } from 'expo-google-sign-in';
    import { AuthSession } from 'expo';
    import * as Constants from 'expo-constants';
    import { AppAuth } from 'expo-app-auth';
    import GoogleSignInButton from './GoogleSignInButton';

    const { OAuthRedirect, URLSchemes } = AppAuth;
    class AuthScreen extends Component {
      state = { user: null };

      componentDidMount() {
        this.initAsync();
        }

        initAsync = async () => {
        await GoogleSignIn.initAsync({
          clientId: '1052072418841-6huufh0eq3mbo22ah7v8aml8esau9fvb.apps.googleusercontent.com',
        });
        this._syncUserWithStateAsync();
      };

      _syncUserWithStateAsync = async () => {
        const user = await GoogleSignIn.signInSilentlyAsync();
        this.setState({ user });
      };

        signOutAsync = async () => {
            await GoogleSignIn.signOutAsync();
            this.setState({ user: null });
          };

          signInAsync = async () => {
            try {
              await GoogleSignIn.askForPlayServicesAsync();
              const { type, user } = await GoogleSignIn.signInAsync();
              if (type === 'success') {
                this._syncUserWithStateAsync();
              }
            } catch ({ message }) {
              alert('login: Error:' + message);
            }
          };


        onPress = () => {
        if (this.state.user) {
          this.signOutAsync();
        } else {
          this.signInAsync();
        }
      };

      get buttonTitle() {
        return this.state.user ? 'Sign-Out of Google' : 'Sign-In with Google';
      }

    render()
    {
      return (
        // <View>
        // <Text>
        // Appauth: {JSON.stringify(AppAuth.URLSchemes, null, 2)}
        // </Text>
        // </View>

        <Card>
        <Button
        type='solid'
        title='Register'
        large
        backgroundColor='#00FFFF'
        onPress={() => Actions.register()}
        />
        <Button
        type='solid'
        title='Loging With Facebook'
        large
        backgroundColor='#00FFFF'
        onPress={() => this.props.facebookLogin()}
        />
        <GoogleSignInButton onPress={this.onPress}>
             {this.buttonTitle}
           </GoogleSignInButton>

        </Card>
      );

    }


    }

    export default connect(null, actions)(AuthScreen);

Все, что мне нужно, это чтобы он отображал экран входа в Google при нажатии на вход в систему с помощью Google

1 Ответ

0 голосов
/ 11 мая 2019

Вход в Google в Expo v32 работает только в автономном режиме, т. Е. Сначала необходимо создать и опубликовать приложение.Не очень удобно, но, по крайней мере, не в тупик.

Более подробно здесь: https://blog.expo.io/react-native-google-sign-in-with-expo-d1707579a7ce

Проверьте также раздел комментариев.

...