My expo auth not working when i publish it to expo, when i download it, its only showing google prompt and redirecting, and doing nothing, not updating the Auth token, nor fetching any data. however its working absolutley fine in development build
` const [accessToken, setAccessToken] = useState();
const [userInfo, setUserInfo] = useState();
const [auth, setAuth] = useState();
const [request, response, promptAsync] = Google.useAuthRequest({
androidClientId:
"xyc",
iosClientId:
"xyc",
expoClientId:
"xyc",
});
useEffect(() => {
if (response?.type === "success") {
setAccessToken(response.authentication);
const persistAuth = async () => {
await AsyncStorage.setItem(
"auth",
JSON.stringify(response.authentication)
);
};
persistAuth();
}
}, [response]);
useEffect(() => {
const getPersistedAuth = async () => {
const jsonValue = await AsyncStorage.getItem("auth");
if (jsonValue != null) {
const authFromJson = JSON.parse(jsonValue);
setAuth(authFromJson);
let userInfoResponse = await fetch(
"https://www.googleapis.com/userinfo/v2/me",
{
headers: { Authorization: `Bearer ${authFromJson.accessToken}` },
}
);
userInfoResponse.json().then((data) => {
setUserInfo(data);
});
setRequireRefresh(
!AuthSession.TokenResponse.isTokenFresh({
expiresIn: authFromJson.expiresIn,
issuedAt: authFromJson.issuedAt,
})
);
}
};
getPersistedAuth();
}, [response]);`
i tried to update my scheme in app.json here is my app.json.
{
"expo": {
"name": "deliveroo",
"slug": "deliveroo",
"version": "1.2.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"scheme": "com.hammadsohaill786.project",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0,
"url": "xyc"
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.hammadsohaill786.project"
},
"android": {
"googleServicesFile": "./google-services.json",
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.hammadsohaill786.deliveroo"
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "xyc"
}
},
"plugins": [
"@react-native-google-signin/google-signin"
],
"runtimeVersion": {
"policy": "sdkVersion"
}
}
}
FIXED*
anyone having a similar problem, make sure to set proxy to false ( promptAsync({ useProxy: false, showInRecents: true }) ), note it may not work on your development Expo GO app, but it will work on your EAS build, which was the issue right?