Back
Linking back to a native app in OAuth flow. Invalid success URL. Expo react native, prebuild android
- 0
- React Native
- Auth

Having trouble linking back to native app with OAuth 2 (react-native-appwrite SDK)
Setup:
TypeScript
export const client = new Client()
.setProject("12345*********")
.setPlatform("com.thisis.myapp");
Below is triggered on button press
TypeScript
const doAuth = async () => {
console.log(Linking.createURL(""));
const account = new Account(client);
const url = account.createOAuth2Token(
OAuthProvider.Google,
Linking.createURL("callback"),
Linking.createURL("callback"),
[]
);
if (url) {
console.log(url.href);
const result = await WebBrowser.openAuthSessionAsync(
url.href,
Linking.createURL("callback")
);
console.log(result);
}
};```
> Error:
> {
> "message": "Invalid `success` param: URL host must be one of: localhost, cloud.appwrite.io, appwrite.io",
> "code": 400,
> "type": "general_argument_invalid",
> "version": "1.6.0"
> }
When testing, if i remove the callback urls, a user is registered in appwrite but I am not redirected back to the app from appwrite.
`const url = account.createOAuth2Token(OAuthProvider.Google);`
> Missing redirect URL
> Your OAuth login flow is missing a proper redirect URL. Please check the OAuth docs and send request for new session with a valid callback URL.
Where am I going wrong here? I have seen similar posts but they seem to solve for web, not native apps. Not seeing any help with react native oauth in the docs.
Related issues:
https://discord.com/channels/564160730845151244/1289689242670202880
https://appwrite.io/threads/1253915948969234432
https://appwrite.io/threads/1193987885905489960
ChatGPT suggests going to a section within appwrite where you can add authorized redirect URLS (would add "com.thisis.myapp"). This makes sense to me but that doesn't appear to be a setting.
TL;DR
Developers are having issues linking back to a native app in OAuth 2 flow using Expo React Native and experiencing an "Invalid 'success' param" error due to incorrect URL host. To resolve, you need to add authorized redirect URLs in Appwrite settings, although this might not be readily available. The error also suggests the OAuth login flow is missing a valid redirect URL. Recommended threads
- Project receiving 403 Forbidden on /v1/a...
Project ID: 68521bce002aaebde8d0 Endpoint: https://fra.cloud.appwrite.io/v1 Problem: I am receiving a 403 Forbidden error with an empty response body when try...
- 301 Redirects on OAuth Endpoints Breakin...
Hello, **Project ID**: 6878bf3f003760131a6d **Custom Domain**: api.hustleproof.app **Problem**: New users are unable to sign up via Google OAuth on my custom ...
- App Crash with android preview build exp...
The expo app with appwrite works fine on web and expo app, but when I do a preview build and install on physical device, it crashed after I open it. The error i...
