expo integration not firing callback

Basically what the title says, after successfully signin in with google the callback url is not fired or the app doesn't navigate at all, small demo below. - And as seen in the video I'm following a similar code to the example app shown here https://github.com/better-auth/better-auth/blob/main/examples/expo-example/src/app/index.tsx - only redirects after reloading
GitHub
better-auth/examples/expo-example/src/app/index.tsx at main · bette...
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
4 Replies
Liltripple_reid
Liltripple_reidOP9mo ago
anyone having a similar issue here ?
Bart ⚡
Bart ⚡9mo ago
I have the exact same issue, did you fix it?
Liltripple_reid
Liltripple_reidOP8mo ago
@Bart ⚡ I thought the problem was the scheme containing a - but it's not working even after changing it, so no idea man
Shubham-Sinha
Shubham-Sinha8mo ago
For google-auth in expo for the time being use :
import {
GoogleSignin,
isErrorWithCode,
isSuccessResponse,
statusCodes,
} from '@react-native-google-signin/google-signin';

const onSignInWithGoogle = async () => {
try {
const x = await GoogleSignin.hasPlayServices();
const response = await GoogleSignin.signIn();
if (isSuccessResponse(response)) {
const { error } = await authClient.signIn.social({
provider: "google",
idToken: {
token: response.data.idToken!,
},
callbackURL: "/auth/callback",
});
if (error) throw error;
} else {
// sign in was cancelled by user
Toast.show({
type: "info",
text1: "Google sign-in cancelled",
});
}
} catch (error) {
console.log("google sign-in error", error)
if (isErrorWithCode(error)) {
switch (error.code) {
case statusCodes.IN_PROGRESS:
// operation (eg. sign in) already in progress
Toast.show({
type: "error",
text1: "Sign in already in progress",
});
break;
case statusCodes.PLAY_SERVICES_NOT_AVAILABLE:
// Android only, play services not available or outdated
Toast.show({
type: "error",
text1: "PLAY_SERVICES_NOT_AVAILABLE",
});
break;
default:
// some other error happened
}
} else {
Toast.show({
type: "info",
text1: "Google sign-in failed",
});
}
};
};
import {
GoogleSignin,
isErrorWithCode,
isSuccessResponse,
statusCodes,
} from '@react-native-google-signin/google-signin';

const onSignInWithGoogle = async () => {
try {
const x = await GoogleSignin.hasPlayServices();
const response = await GoogleSignin.signIn();
if (isSuccessResponse(response)) {
const { error } = await authClient.signIn.social({
provider: "google",
idToken: {
token: response.data.idToken!,
},
callbackURL: "/auth/callback",
});
if (error) throw error;
} else {
// sign in was cancelled by user
Toast.show({
type: "info",
text1: "Google sign-in cancelled",
});
}
} catch (error) {
console.log("google sign-in error", error)
if (isErrorWithCode(error)) {
switch (error.code) {
case statusCodes.IN_PROGRESS:
// operation (eg. sign in) already in progress
Toast.show({
type: "error",
text1: "Sign in already in progress",
});
break;
case statusCodes.PLAY_SERVICES_NOT_AVAILABLE:
// Android only, play services not available or outdated
Toast.show({
type: "error",
text1: "PLAY_SERVICES_NOT_AVAILABLE",
});
break;
default:
// some other error happened
}
} else {
Toast.show({
type: "info",
text1: "Google sign-in failed",
});
}
};
};

Did you find this page helpful?