Back

[SOLVED] Appwrite GitHub Oauth error

  • 0
  • Web
Utkarsh Nagar | Utkarshn10
23 Sep, 2023, 05:37

Thanks @Steven , adding the complete hostname fixed the issue.

Note: This issue came automatically without even changing the piece of code. The success url has always been the same since the project was hosted but suddenly yesterday this stopped working.

TL;DR
The user was experiencing an error with Appwrite GitHub OAuth. The issue was resolved by changing the multiple domains in Appwrite to a single domain. The user also needed to update the GitHub OAuth settings to include the complete hostname in the callback URL. This fixed the issue.
Utkarsh Nagar | Utkarshn10
23 Sep, 2023, 05:37

Its the same as mentioned in the piece of code i.e ( 'https://hack-bud.vercel.app/')

VincentGe
23 Sep, 2023, 13:55

our domain validator works slightly differenrly now

VincentGe
23 Sep, 2023, 13:55

👀

VincentGe
23 Sep, 2023, 13:55

is this new or a regression from 1.3?

Drake
23 Sep, 2023, 15:55

I think this has always been there

VincentGe
23 Sep, 2023, 15:56

<:KEKW:736600409228967937> I thought we fixed this

VincentGe
23 Sep, 2023, 15:56

I remember raising this when 1.0 came out

Eddie Jaoude | EddieHub
20 Nov, 2023, 19:07

I get the same error with NextJS and GitHub OAuth

TypeScript
{"message":"Invalid `success` param: URL host must be one of: localhost, appwrite.jaoudestudios.co.uk, *.vercel.app,localhost,*.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
TypeScript
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 to localhost, and added to allowed hostnames
TypeScript
const login = async () => {
    account.createOAuth2Session(
      "github",
      "http://rating.jaoudestudios.co.uk:3000/account",
      "http://rating.jaoudestudios.co.uk:3000/failed"
    );
  };

Let me know if you prefer me to start a new discussion

D5
20 Nov, 2023, 19:12

Your appwrite version is 0.11.33 ?

Eddie Jaoude | EddieHub
20 Nov, 2023, 19:12

I did try by adding the complete sub domain and not the wildcard but same error

ideclon
20 Nov, 2023, 19:12

It’s not about the domain you’re connecting to Appwrite with, it’s about the domain you’re redirecting to from GitHub. Wildcards are not supported

Eddie Jaoude | EddieHub
20 Nov, 2023, 19:13

ah ok, I forgot about the redirect back, let me check the github oauth settings

Eddie Jaoude | EddieHub
20 Nov, 2023, 19:14

where can i check this?

D5
20 Nov, 2023, 19:17

You're adding 2 domains at the same time

D5
20 Nov, 2023, 19:17

Also put there the entire domain including the subdomain

D5
20 Nov, 2023, 19:17

Footer of the console

Eddie Jaoude | EddieHub
20 Nov, 2023, 19:17

still the same error after changing from wildcard and updating github oauth settings

TypeScript
{"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"}
Eddie Jaoude | EddieHub
20 Nov, 2023, 19:18

it says Version 1.4.13

D5
20 Nov, 2023, 19:19

Create a separate post then since it's different from main issue

D5
20 Nov, 2023, 19:20
Eddie Jaoude | EddieHub
20 Nov, 2023, 19:20

ok sure, i thought it was the same, but i can do that now if you think it is different

ideclon
20 Nov, 2023, 20:13

And what’s the callback URL you’re setting when you create the OAuth request in your code?

Eddie Jaoude | EddieHub
20 Nov, 2023, 20:16

btw we started a new discussion and solve the issue here (the fix was the mulitple domains in Appwrite, changing it to a single domain) https://discord.com/channels/564160730845151244/1176241774038110218

D5
20 Nov, 2023, 20:20

[SOLVED] Appwrite GitHub Oauth error

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more