dazzling-lock-68691
09/29/2022, 9:23 AM<https://auth.hypt.dev>
- A backend api available at <https://api.client-area.hypt.dev>
(but thatβs not called in this case)
Now what weβve done:
- The angular app does not use the SDK, for now we only use Login, so we simply make the two calls from the SPA on our own as it is described in the docs [1]:
- first to <https://auth.hypt.dev/self-service/login/browser>
- then to <https://auth.hypt.dev/self-service/login?flow=><flow_id>
- We have configured CORS for our Angular App (on the level of Azure web service) for all domains involved (screenshot 1)
- We have also configured CORS in Ory: the UI and the backend API are both set in the CORS Allowed origins. (screenshot 2)
However when trying to log the CORS errors as shown in screenshot 3 is shown. This is when the first request is executed to fetch the flow_id.
Interestingly there is no Access-Control-Allow-Origin
returned by this call.
When developing locally using ory proxy
to tunnel the logins, it works. So there does not seem a logic error in the application.
Anyone should be able to reproduce the issue, since we pre-filled the credentials since we have no live data on that system.
Can somebody help me with this issue? Thanks in advance!
[1] https://www.ory.sh/docs/kratos/self-service/flows/user-login#login-for-client-side-ajax-browser-clientsdazzling-lock-68691
09/29/2022, 9:26 AMproud-plumber-24205
09/29/2022, 9:54 AMcredentials
here?
CORS errors exist through the browser only (e.g. make the same call with cURL and you will see CORS is not used).
It can exist for a couple of reasons:
1. Ory is not allowing the domain of your SPA
2. Your SPA is not calling Ory correctly fetch with credentialssteep-lamp-91158
dazzling-lock-68691
09/29/2022, 10:10 AMdazzling-lock-68691
09/29/2022, 10:19 AMcredentials
affect the CORS behaviour? I guess we haven't set it for the init call, but let me check.steep-lamp-91158
curl -sSL -D - <https://auth.hypt.dev/self-service/login/browser> -X OPTIONS -H "Access-Control-Request-Method: GET" -H "Access-Control-Request-Headers: content-type" -H "Origin: <https://rocket.hypt.dev>"
HTTP/2 204
date: Thu, 29 Sep 2022 10:19:38 GMT
access-control-allow-credentials: true
access-control-allow-headers: Content-Type
access-control-allow-methods: GET
access-control-allow-origin: <https://rocket.hypt.dev>
access-control-max-age: 5
vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers
cf-cache-status: DYNAMIC
set-cookie: __cflb=0pg1Sf1ZS9LP1qqZFPyvyxV6cBa8cu5wgRCQ1pWX; SameSite=None; Secure; path=/; expires=Thu, 29-Sep-22 11:19:38 GMT; HttpOnly
server: cloudflare
cf-ray: 7523fb4d88d0b3a4-MUC
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
steep-lamp-91158
fetch('<https://auth.hypt.dev/self-service/login/browser>', { credentials: 'include'})
steep-lamp-91158
dazzling-lock-68691
09/29/2022, 10:24 AMdazzling-lock-68691
09/29/2022, 10:27 AMwithCredentials: true
for our http calls to ory and our backend. So we'll check if we have a bug on our side here.steep-lamp-91158
steep-lamp-91158
{ credentials: 'include' }
dazzling-lock-68691
09/29/2022, 10:32 AM"HttpClient"
and have set withCredentials: true
https://angular.io/api/common/http/HttpClientdazzling-lock-68691
09/29/2022, 10:49 AMsteep-lamp-91158