Getting CORS error on Railway API

10 months ago

I tried to consume the API in a expo app, ended up with CORS error

curl 'https://backboard.railway.com/graphql/v2' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'authorization: Bearer ' \
  -H 'Referer: http://localhost:8081/' \
  -H 'sec-ch-ua: "Not;A=Brand";v="99", "Google Chrome";v="139", "Chromium";v="139"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36' \
  -H 'accept: application/graphql-response+json,application/json;q=0.9' \
  -H 'content-type: application/json' \
  --data-raw '{"operationName":"Me","variables":{},"query":"query Me {\n  me {\n    id\n    name\n    username\n    avatar\n    email\n    workspace {\n      id\n      name\n      preferredRegion\n      __typename\n    }\n    workspaces {\n      id\n      name\n      preferredRegion\n      __typename\n    }\n    __typename\n  }\n}"}'

7 Replies

10 months ago

Test


10 months ago

Hello,

Our API is only going to return the correct CORs headers for our frontend.


10 months ago

Thanks Brody, So is there any way I can use the Railway's public api? https://docs.railway.com/guides/public-api#endpoint


10 months ago

You can use it from a backend, it wouldn't be usable from a browser.


10 months ago

ahh i see, thought it would support the client apps too

no worries, i can make a proxy server for this, but I bet it gonna increase the latency for me


10 months ago

PS: I was experimenting with mobile app for Railway


10 months ago

!s


Welcome!

Sign in to your Railway account to join the conversation.

Loading...