I am working on an app that requires SignIn with Apple and Google via FireBase. In development mode, signIn was working fine with both. But after deploying it in TestFlight, I cannot SignIn with Them anymore.
also the code for SignIn with Google and Apple :
Google:
import * as Google from "expo-google-app-auth";
try {
const result = await Google.logInAsync({
iosClientId:
"##############.apps.googleusercontent.com",
scopes: ["profile", "email"],
});
if (result.type === "success") {
const { idToken, accessToken } = result;
const credential = firebase.auth.GoogleAuthProvider.credential(
idToken,
accessToken
);
var user = firebase.auth().currentUser;
user.linkWithCredential(credential).then(async () => {}
Apple:
import * as AppleAuthentication from "expo-apple-authentication";
import * as Crypto from "expo-crypto";
try {
const csrf = Math.random().toString(36).substring(2, 15);
const nonce = Math.random().toString(36).substring(2, 10);
const hashedNonce = await Crypto.digestStringAsync(
Crypto.CryptoDigestAlgorithm.SHA256,
nonce
);
const appleCredential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
state: csrf,
nonce: hashedNonce,
});
const { identityToken, email, state } = appleCredential;
if (identityToken) {
const provider = new firebase.auth.OAuthProvider("apple.com");
const credential = provider.credential({
idToken: identityToken,
rawNonce: nonce, // nonce value from above
});
var user = firebase.auth().currentUser;
user.linkWithCredential(credential).then(async () => {})}