LOG RNGoogleSignInError: Unknown error in google sign in., Error Domain=org.openid.appauth.general Code=-15 "ID Token expired" UserInfo={NSLocalizedDescription=ID Token expired}
Code below :
import React from 'react';
import {
SafeAreaView,
Button,
View,
} from 'react-native';
import auth from '@react-native-firebase/auth';
import {
GoogleSignin,
statusCodes,
} from '@react-native-google-signin/google-signin';
import {LoginManager, AccessToken} from 'react-native-fbsdk-next';
import {sha256} from 'react-native-sha256';
import {GoogleSigninButton} from '@react-native-google-signin/google-signin';
GoogleSignin.configure({
webClientId:
'349571960167-bpreej8pan5o9011sbq99fo6m0skjo73.apps.googleusercontent.com',
iosClientId:
'349571960167-kc3g2v5q8mitap97roso6af9pn7mn1s0.apps.googleusercontent.com',
offlineAccess: true,
// iosClientId: '349571960167-kc3g2v5q8mitap97roso6af9pn7mn1s0.apps.googleusercontent.com'
});
function App() {
const signOut = async () => {
try {
await GoogleSignin.signOut();
setState({user: null}); // Remember to remove the user from your app's state as well
} catch (error) {
console.error(error);
}
};
async function onGoogleButtonPress() {
try {
await GoogleSignin.hasPlayServices({showPlayServicesUpdateDialog: true});
// Get the users ID token
const userInfo = await GoogleSignin.signIn();
console.log(userInfo, 'userInfo')
// Create a Google credential with the token
const googleCredential = auth.GoogleAuthProvider.credential(userInfo.idToken);
// Sign-in the user with the credential
return auth().signInWithCredential(googleCredential);
} catch (error) {
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
console.log(statusCodes.SIGN_IN_CANCELLED)
// user cancelled the login flow
} else if (error.code === statusCodes.IN_PROGRESS) {
// operation (e.g. sign in) is in progress already
console.log(statusCodes.IN_PROGRESS)
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
// play services not available or outdated
console.log(statusCodes.PLAY_SERVICES_NOT_AVAILABLE)
} else {
// some other error happened
console.log(error.message);
}
}
}
return (
<SafeAreaView>
<View>
<GoogleSigninButton onPress={() => onGoogleButtonPress().then(() => console.log('success 123123'))} />
</View>
</SafeAreaView>
);
}
export default App;
Google signin not working on IOS (17.04)
LOG RNGoogleSignInError: Unknown error in google sign in., Error Domain=org.openid.appauth.general Code=-15 "ID Token expired" UserInfo={NSLocalizedDescription=ID Token expired}
Code below :
Detail :