I get the error with NextJS and GitHub OAuth, i found this and tried to use it to solve by moving from locahost
to using sub domains https://github.com/appwrite/appwrite/issues/1203#issuecomment-850787160
{"message":"Invalid `success` param: URL host must be one of: localhost, appwrite.jaoudestudios.co.uk, *.vercel.app,localhost,rating.jaoudestudios.co.uk","code":400,"type":"general_argument_invalid","version":"0.11.33"}
After research, I have done the following, am I missing something?
- used a custom sub domain
appwrite.jaoudestudios.co.uk
and added it to my Appwrite Cloud project - using custom sub domain to connect to Appwrite
const client = new Client()
.setEndpoint("https://appwrite.jaoudestudios.co.uk/v1")
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID);
- using a host file for
rating.jaoudestudios.co.uk
to point tolocalhost
, and added to allowed hostnames
const login = async () => {
account.createOAuth2Session(
"github",
"http://rating.jaoudestudios.co.uk:3000/account",
"http://rating.jaoudestudios.co.uk:3000/failed"
);
};
- github oauth settings is
https://appwrite.jaoudestudios.co.uk/v1/account/sessions/oauth2/callback/github/XXX
For the hostname, can you try creating separate web platforms for each?
I only created the sub domains because of the GitHub Discussion with cross domain limitations on OAuth, I am happy to use localhost
In order for the cookies to work as 1st party, the Appwrite endpoint needs to be a subdomain for your app. So if your app is on rating.jaoudestudios.co.uk, the Appwrite endpoint would need to be on something like appwrite.rating.jaoudestudios.co.uk
oh really? not what I understand from the github discussion but I can try still that
You can try...
I will try now π
But you'll need separate web platforms. Comma separated values here won't work
ok, so I will need one for each sub domain?
it seems to work, but I made 2 changes, I think the fix was removing the comma separate domains and leaving only 1
thank you for your help Steven!
Fyi, I'm pretty sure we have a PR pending merge/release to return an error if you pass in invalid hostname
it has multiple domains in there already to begin with, so I just appended an additional domain - that would be great, it would have saved me most of the day
Hmm I'm not sure how/why it had multiple π§
[SOLVED] github oauth error "general_argument_invalid"
github oauth error "general_argument_invalid"
@Eddie Jaoude | EddieHub Sorry, I closed the wrong post π«£
I thought this was the old one
My apologies π
no worries π
Anyways, did you have solved it?
yes it is now solved π
Okay, so seems I could mark it anyways π
Glad to hear
[SOLVED] github oauth error "general_argument_invalid"
Recommended threads
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here π I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...