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.ukand 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.ukto 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
- Collections list not showing up when try...
I'm trying to create new relationship attribute but both one way and two way relationship is not showing up collections list to connect with my relationship att...
- I have try to use the appwrite in to the...
Invalid Origin. Register your new client (oailedjdbkhlkakmnnapoonllbnfmfij) as a new Web (Chrome Extension) platform on your project console dashboard
- Paused project can't activate
I have failed to reactivate one my projects which had been paused