Вот что я сделал
- Создание учетных данных Oauth в GCP

Вот веб-конфигурация

Вот конфигурация Android

Вот конфигурация IOS
- React Native Code
Код: Выделить всё
// src/screens/LoginScreen.js import React, { useState } from "react"; import { View, Text, TextInput, TouchableOpacity, Image, } from "react-native"; import { GoogleSignin, statusCodes, } from '@react-native-google-signin/google-signin'; import styles from "../styles/LoginScreenStyles"; import Icon from "react-native-vector-icons/MaterialIcons"; import GooglePng from "../../assets/google.png"; import { ANDROID_SSO, API, IOS_SSO, WEB_SSO } from "../utils/constants"; import axios from "axios"; import SpinnerOverlay from "../components/SpinnerOverlay"; const LoginScreen = ({ navigation }) => { const [loading, setLoading] = useState(false); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [user, setUser] = useState(""); const [error, setError] = useState(""); const usernameRegex = /^[a-zA-Z0-9._-]{3,20}$/; const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,16}$/; const handleNativeLogin = async () => { try { setLoading(true); const userName = user; const userPassword = password; const response = await axios.post(API.LOGIN, { username: userName, password: userPassword, sso: false, }); const { validUser, isVerified, email } = response.data.data; if (validUser) { if (isVerified) { navigation.navigate("Home"); } else { navigation.navigate("RegistrationVerification", { email }); await axios.post(API.SEND_OTP, { email }); } setUser(""); setPassword(""); } else { setError("Invalid Username or Password"); } } catch (err) { setError(err.response?.data?.message?.message || "An error occurred."); } finally { setLoading(false); setShowPassword(false); } }; GoogleSignin.configure({ webClientId: 'web_client_id.apps.googleusercontent.com', offlineAccess: true }); **const handleGoogleLogin = async () => { try { setLoading(true); // Ensure Play Services are available (Android only) await GoogleSignin.hasPlayServices({showPlayServicesUpdateDialog: true}); // Start Google Sign-In process const userInfo = await GoogleSignin.signIn(); // Example backend response handling const response = await axios.post(API.LOGIN, { username: userInfo.user.email, sso: true, }); if (response.data.success) { navigation.navigate("Home"); } else { setError("Error Logging In via Google"); } } catch (err) { if (err.code === statusCodes.SIGN_IN_CANCELLED) { setError("Sign-in cancelled."); } else if (err.code === statusCodes.IN_PROGRESS) { setError("Sign-in already in progress."); } else if (err.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) { setError("Google Play Services not available."); } else { setError("An unknown error occurred."); console.error(err); } } finally { setLoading(false); } };** return ( {loading && } Welcome Back! setShowPassword(!showPassword)}> navigation.navigate("ForgotPassword")} > Forgot Password? Login {error ? {error} : null} or {/* Google Login */} Login with Google { navigation.navigate("SignUp", { sso: false }); setUser(""); setPassword(""); setShowPassword(false); setError(""); }} > Don't have an account? Sign up ); }; export default LoginScreen;
com.google.android.gms. common.api.apieException Developer_error
Для отладки я протестировал идентификатор веб-клиента в приложении реагирования, запущенном на порту 3000, и он отлично работает в приложении реагирования.
Как решить эту проблему? Дайте мне знать, если кому-то понадобится что-нибудь еще, чтобы получить больше контекста
Подробнее здесь: https://stackoverflow.com/questions/793 ... oper-error