-
Notifications
You must be signed in to change notification settings - Fork 30
Invalid success param when using OAuth2 login #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@schoolofai, thanks for creating this issue! 🙏🏼 Could you please share exactly what the |
So, at the moment, Expo will create deep links like:
Appwrite will try to validate the host part of the URL against the allowed web platforms to protect against open redirect attacks so you'll get a 400 error like:
It's impossible to change RN to include a hostname or you may run into a path not found error when redirect back into the RN app. We'll have to discuss internally about how to handle react native. |
appwrite/appwrite#9262 was merged but then reverted due to issues during QA. We'll need to fix the issues with another PR. |
same issue here general_argument_invalid working fine in ios simulation and expo qr code run issue in android emulator
|
I have the same problem, here is my current implementation import { getQueryParams } from "expo-auth-session/build/QueryParams";
import { openAuthSessionAsync } from "expo-web-browser";
----
const createSessionFromUrl = async (url: string) => {
try {
const { params, errorCode } = getQueryParams(url);
if (errorCode) throw new Error(errorCode);
const { secret, userId } = params;
if (!secret || !userId) return;
return await account.createSession(userId, secret);
} catch (error) {
console.error("Error creating session from URL:", error);
throw error;
}
};
signWithOAuth: async (provider: OAuthProvider) => {
const url = await account.createOAuth2Session(
provider,
"myCoolAppwriteApp://(authenticated)",
"myCoolAppwriteApp://auth",
["openid", "profile"]
);
if (!url) throw new Error("Failed to create OAuth2 session");
const res = await openAuthSessionAsync(
url.toString(),
"myCoolAppwriteApp://home"
);
if (res.type === "success") {
const { url } = res;
if (!url) throw new Error("Failed to create session from URL");
await createSessionFromUrl(url);
}
}, |
Did u find any solution
Is this our implementation problem or appwrite issue in local ecpo its
working fine because its localhost the deep link concept is not working
…On Fri, 28 Mar, 2025, 5:00 pm Dennis Hundertmark, ***@***.***> wrote:
I have the same problem, here is my current implementation
import { getQueryParams } from "expo-auth-session/build/QueryParams";import { openAuthSessionAsync } from "expo-web-browser";
----
const createSessionFromUrl = async (url: string) => {
try {
const { params, errorCode } = getQueryParams(url);
if (errorCode) throw new Error(errorCode);
const { secret, userId } = params;
if (!secret || !userId) return;
return await account.createSession(userId, secret);
} catch (error) {
console.error("Error creating session from URL:", error);
throw error;
}};
signWithOAuth: async (provider: OAuthProvider) => {
const url = await account.createOAuth2Session(
provider,
"myCoolAppwriteApp://(authenticated)",
"myCoolAppwriteApp://auth",
["openid", "profile"]
);
if (!url) throw new Error("Failed to create OAuth2 session");
const res = await openAuthSessionAsync(
url.toString(),
"myCoolAppwriteApp://home"
);
if (res.type === "success") {
const { url } = res;
if (!url) throw new Error("Failed to create session from URL");
await createSessionFromUrl(url);
}
},
—
Reply to this email directly, view it on GitHub
<#34 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2VPJ3C4HUUREW242XTFS5L2WUQDDAVCNFSM6AAAAABQYN6EECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRRGEYDCOJTGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: mnkyjs]*mnkyjs* left a comment (appwrite/sdk-for-react-native#34)
<#34 (comment)>
I have the same problem, here is my current implementation
import { getQueryParams } from "expo-auth-session/build/QueryParams";import { openAuthSessionAsync } from "expo-web-browser";
----
const createSessionFromUrl = async (url: string) => {
try {
const { params, errorCode } = getQueryParams(url);
if (errorCode) throw new Error(errorCode);
const { secret, userId } = params;
if (!secret || !userId) return;
return await account.createSession(userId, secret);
} catch (error) {
console.error("Error creating session from URL:", error);
throw error;
}};
signWithOAuth: async (provider: OAuthProvider) => {
const url = await account.createOAuth2Session(
provider,
"myCoolAppwriteApp://(authenticated)",
"myCoolAppwriteApp://auth",
["openid", "profile"]
);
if (!url) throw new Error("Failed to create OAuth2 session");
const res = await openAuthSessionAsync(
url.toString(),
"myCoolAppwriteApp://home"
);
if (res.type === "success") {
const { url } = res;
if (!url) throw new Error("Failed to create session from URL");
await createSessionFromUrl(url);
}
},
—
Reply to this email directly, view it on GitHub
<#34 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2VPJ3C4HUUREW242XTFS5L2WUQDDAVCNFSM6AAAAABQYN6EECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRRGEYDCOJTGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I having same issue Invalid 'success' param: URL host must be one of: localhost, appwrite.io, *.appwrite.io, fra.cloud.appwrite.io, * Type general_argument_invalid |
@stnguyen90 so what's the solution now? |
Has anyone gotten a solution yet? |
When launching the project via expo, everything works and is displayed in the console: And with the native build for Android, error 400 and console output: Maybe this will help you solve the problem somehow.🙏 |
I found this article quiet helpful and was able to enable OIDC Provider (Keycloak) and get everything to work. |
Uh oh!
There was an error while loading. Please reload this page.
hi i am having issues with using google oauth for login - I am using react native sdk - it all works when on expo go , but when i installed it to testfight it stops working - and when trying to login with google - in get invalid sucess param should be one of - localhost .... etc . here is my sign in code -
see the screen shot for google cloud credentials
Image
The text was updated successfully, but these errors were encountered: