Back

CORS

  • 0
  • Accounts
ski
30 Jun, 2023, 23:05

Hey I need a little bit of help understanding why I got this CORS error for X-appwrite-project

TL;DR
Multiple users are experiencing CORS (Cross-Origin Resource Sharing) errors when making fetch requests with OAuth. One user suggests redirecting the user to the URL instead of making a fetch request. Another user requests network logs to troubleshoot the issue. Some users mention encountering the same error regardless of the OAuth provider used, specifically on Appwrite Cloud. One user notices that the request is being made to Discord instead of the intended destination. Another user reports getting a server error 500 when adding new storage buckets on a self-hosted Appwrite installation. Flutter and REST API calls are mentioned as part of the configuration. The solution or resolution to the CORS error
Guille
30 Jun, 2023, 23:34

can you tell us more about your configuration; what domain have appwrite, and your frontend, also did you add it your frontend as platform?

ski
30 Jun, 2023, 23:38

Yes am using flutter I add it as my platform in the appwrite console 2. I provide a success and failure argument, an not using the flutter sdk, am using rest api call

bopr
30 Jun, 2023, 23:56

I started getting the same error recently (even after updating to 1.3.7)

I am using a web platform with the hostname matching the vercel deployed site.

TypeScript
AppwriteException: Server Error
    Immutable 3
_layout.svelte.01201c3c.js:5:164
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://o1063647.ingest.sentry.io/api/4504158071422976/envelope/?sentry_key=c7ce178bdedd486480317b72f282fd39&sentry_version=7&sentry_client=sentry.javascript.svelte%2F7.45.0. (Reason: CORS request did not succeed). Status code: (null).

I am also getting server error 500 when adding new storage buckets (on my self hosted appwrite, not on cloud.appwrite.io)

ski
1 Jul, 2023, 01:20

Help anyone?

Drake
1 Jul, 2023, 14:06

This says the request is to discord? 🧐

ski
1 Jul, 2023, 16:01

No matter which oAuth2 provider I use it the same errors ( appwrite cloud )

Drake
1 Jul, 2023, 19:26

Would you please show the network logs?

ski
1 Jul, 2023, 19:35

:Authority: github.com :Method: OPTIONS :Path: /login/oauth/authorize?client_id=d74e423011f369fead64&redirect_uri=https%3A%2F%2Fcloud.appwrite.io%2Fv1%2Faccount%2Fsessions%2Foauth2%2Fcallback%2Fgithub%2F648f639d3f9b3365885b&scope=user%3Aemail&state=%7B%22success%22%3A%22https%3A%5C%2F%5C%2Fcloud.appwrite.io%5C%2Fauth%5C%2Foauth2%5C%2Fsuccess%22%2C%22failure%22%3A%22https%3A%5C%2F%5C%2Fcloud.appwrite.io%5C%2Fauth%5C%2Foauth2%5C%2Ffailure%22%7D :Scheme: https Accept: / Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Access-Control-Request-Headers: content-type,x-appwrite-project Access-Control-Request-Method: GET Origin: null Referer: http://localhost:300/ Sec-Fetch-Dest: empty Sec-Fetch-Mode: cors Sec-Fetch-Site: cross-site User-Agent: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Drake
1 Jul, 2023, 19:36

This is a fetch request? It's not supposed to be a fetch request. For oauth, you're supposed to redirect the user to the url. For example: https://github.com/appwrite/sdk-for-web/blob/7b37a2bec1dbe47b55e2c962996046f56b763192/src/services/account.ts#L683

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