breezy-journalist-86771
05/10/2023, 3:31 PMAccess to 'https://<slug>.<http://projects.oryapis.com/oauth2/token|projects.oryapis.com/oauth2/token>' from origin '<https://mysite.localtest.me>' was blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response meets your needs, set the request mode to 'no-cors' to retrieve the resource with CORS disabled.
We enabled cors with the command:
ory patch oauth2-config <clientId> --replace '/serve/public/cors/enabled=true'
and added allowed_origins:
ory patch oauth2-config <clientId> --replace '/serve/public/cors/allowed_origins=["<https://mysite.localtest.me>","*"]'
But it's not reflected on the GUI, and not working for us.proud-plumber-24205
05/10/2023, 3:48 PMfresh-carpet-18970
05/11/2023, 8:06 AMfresh-carpet-18970
05/11/2023, 8:06 AMfresh-carpet-18970
05/11/2023, 8:08 AMfresh-carpet-18970
05/11/2023, 8:09 AMfresh-carpet-18970
05/11/2023, 8:12 AMfresh-carpet-18970
05/11/2023, 8:15 AMfresh-carpet-18970
05/11/2023, 8:15 AMproud-plumber-24205
05/11/2023, 9:47 AMproud-plumber-24205
05/11/2023, 9:48 AMfresh-carpet-18970
05/11/2023, 12:07 PMfresh-carpet-18970
05/11/2023, 12:08 PMhydra_serve_public_cors_enable and hydra_serve_public_cors_allowed_origins?fresh-carpet-18970
05/11/2023, 12:08 PMfresh-carpet-18970
05/11/2023, 12:12 PM.services.oauth2.config.serve.public.cors.enabled and .services.oauth2.config.serve.public.cors.allowed_originsfresh-carpet-18970
05/11/2023, 12:12 PMory get project --format jsonproud-plumber-24205
05/11/2023, 1:19 PMproud-plumber-24205
05/11/2023, 1:19 PMproud-plumber-24205
05/11/2023, 1:22 PMfresh-carpet-18970
05/11/2023, 2:21 PMfresh-carpet-18970
05/11/2023, 3:04 PMproud-plumber-24205
05/11/2023, 3:13 PMfresh-carpet-18970
05/11/2023, 3:16 PMbest-napkin-88358
05/15/2023, 7:30 AMaccess-control-allow-origin header added in responses from Ory Cloud
β― curl -X GET -I <https://idp.wesaluteapis.com/.well-known/openid-configuration>
HTTP/2 200
date: Mon, 15 May 2023 07:30:22 GMT
content-type: application/json; charset=utf-8
cache-control: private, no-cache, no-store, must-revalidate
vary: Origin,Origin
cf-cache-status: DYNAMIC
set-cookie: __cflb=04dTofjtHwhfCny3TibZzRnKNQfNMfGGxmgM3c4DEK; SameSite=None; Secure; path=/; expires=Mon, 15-May-23 08:30:22 GMT; HttpOnly
server: cloudflare
cf-ray: 7c79acd9ca176943-FRAfresh-carpet-18970
05/15/2023, 1:14 PMfresh-carpet-18970
05/15/2023, 1:15 PMcurl -X OPTIONS -I <https://idp.wesaluteapis.com/.well-known/openid-configuration> -H 'Access-Control-Request-Method:GET' -H 'Origin:<http://idp.wesaluteapis.com|idp.wesaluteapis.com>'fresh-carpet-18970
05/15/2023, 1:17 PM<http://idp.wesaluteapis.com|idp.wesaluteapis.com>. Use yours instead of <http://idp.wesaluteapis.com|idp.wesaluteapis.com> and you should see in the returned data something like access-control-allow-methods: GETfresh-carpet-18970
05/15/2023, 1:17 PMaccess-control-allow-origin: <your origin>best-napkin-88358
05/15/2023, 1:24 PMβ― curl -X OPTIONS -I <https://idp.wesaluteapis.com/.well-known/openid-configuration> -H 'Access-Control-Request-Method:GET' -H 'Origin:<http://www.example.com|www.example.com>'
HTTP/2 204
date: Mon, 15 May 2023 13:22:38 GMT
vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers
cf-cache-status: DYNAMIC
set-cookie: __cflb=04dTofjtHwhfCny3TibZzRnKNQfNMfGKaYSqXPvXcF; SameSite=None; Secure; path=/; expires=Mon, 15-May-23 14:22:38 GMT; HttpOnly
server: cloudflare
cf-ray: 7c7bb0ddce70923e-FRA
Still no CORS headers in the response.best-napkin-88358
07/06/2023, 10:45 AMhigh-optician-2097
steep-lamp-91158
ory patch oauth2-config <clientId> --replace '/serve/public/cors/allowed_origins=["<https://mysite.localtest.me>","*"]'
to enable cors, you have to use this workaround in the JS console on https://console.ory.sh while being on the correct project:
const projectId = new URL(window.location).pathname.split("/")[2]
await fetch(`<https://api.console.ory.sh/normalized/projects/${projectId}/revision/${(await> fetch(`<https://api.console.ory.sh/normalized/projects/${projectId}>`, { credentials: "include" }).then(r => r.json())).current_revision.id}`, { credentials: "include", method: "PATCH", body: JSON.stringify([{ op: "replace", path: "/serve_public_cors_enabled", value: true }])})