커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
구글 소셜 로그인 expo-google-app-auth
앱개발 종합반 - 리액트 네이티브 v7
기타
북마크
박*수
댓글
3
추천
0
조회수
10
조회수
10
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


어...구글 소셜로그인 작업중인데 async awit에서 해결이 안되는 부분이 있어서요 ㅠㅠ




스파르타 즉문즉답스파르타 즉문즉답


저렇게 async에 줄이 쳐져 있는데 원인을 잘 모르겠네요...

작성한 코드 및 에러 메세지

import { StatusBar } from 'expo-status-bar';

import React, { useState } from 'react';

import { StyleSheet, Text, View, Button } from 'react-native';

import * as Google from 'expo-google-app-auth';


export default function LoginPage() {

  const [userInfo, setUserInfo] = useState();


  const config = {

   

    androidClientId: `xxx`,

    androidStandaloneAppClientId: `xxxx`,

    scopes: ['profile', 'email']

  };

  const onPress = async () => {

    await Google.logInAsync(config)

      .then((result) => {

        setUserInfo(result);

      })

      .catch(error => {

        console.log('error logInAsync');

        console.log(error);


      });

  }

  return (

    <View style={styles.container}>

      <Button

        title='Sign In With google'

        button

        type='google'

        onPress={onPress}

      />

      <Text>

        {JSON.stringify(userInfo)}

      </Text>

    </View>

  );

}


const styles = StyleSheet.create({

  container: {

    flex: 1,

    backgroundColor: '#fff',

    alignItems: 'center',

    justifyContent: 'center',

  },

});



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴