ReqimaOriginal post
Web Developer
For 3 days I no longer understand why redirects with Google Auth on React Native do not work at all. I saw people asking the problem but the solutions do not work for me. Please help me.
// ... code
const oauthProvider = {
google: OAuthProvider.Google,
apple: OAuthProvider.Apple,
}[provider.toLowerCase()];
if (!oauthProvider) {
throw new Error(`Unsupported provider: ${provider}`);
}
const redirectSuccessUri = Linking.createURL("/");
const redirectFailureUri = Linking.createURL("/error");
const response = account.createOAuth2Token(
oauthProvider,
redirectSuccessUri,
redirectFailureUri
);
if (!response) {
throw new Error("Response is undefined");
}
// ... code
Summary
Developers are having trouble getting Google OAuth redirects to work in React Native, even after trying various solutions found online.
One potential solution to fix the issue could be to ensure that the redirectSuccessUri and redirectFailureUri are correctly specified and matching the expected values on the Google API side. Double-checking the implementation details and configuration of OAuthProvider.Google could also help in resolving the problem.