magnificent-oxygen-19823
09/27/2024, 7:33 AMmagnificent-energy-493
magnificent-oxygen-19823
09/27/2024, 8:22 AMwithCredentials: true
in Dio is not working as expected. We have tested and verified that this is infact an issue with our client and not the server - if we run this command in the console under the same domain - we get a response but via the flutter app we get a CORS issue and noticed the headers with cookies are not being set.
fetch('<https://accounts05.bullbitcoin.dev/api/.ory/sessions/whoami>', {credentials: 'include'}).then((res) => { return res.json() }).then((data) => { console.log(data) })
I was going to open an issue on Github but saw that you guys have a community slack so I thought I'd come here first.magnificent-oxygen-19823
09/27/2024, 8:26 AMDioForBrowser
and not just standard Dio
- looks like ory-sdk uses standard Dio
everywhere. There was a moment last week where we got things to work but for some reason now its back to not working as expected.magnificent-oxygen-19823
09/27/2024, 8:28 AMwithCredentials
in multiple places:
• in Dio's BaseOptions
• in BrowserHttpAdapter (as stated in the docs)
• in the call to toSession
as extra
We have tried combinations of just 1 of the above, pairs of 2, and in all 3 places; none of them have given an expected result.magnificent-oxygen-19823
09/27/2024, 8:33 AMwhoami
endpoints for Login and the logout endpoint in our dart client - but long term it would be good to fix this in the sdk (assuming thats where the issue is and not our implementation)magnificent-energy-493
magnificent-oxygen-19823
09/27/2024, 10:02 AMmagnificent-oxygen-19823
09/29/2024, 1:01 PMmagnificent-oxygen-19823
09/29/2024, 1:02 PMmagnificent-oxygen-19823
09/29/2024, 1:02 PMmagnificent-oxygen-19823
09/29/2024, 1:02 PMmagnificent-energy-493
magnificent-oxygen-19823
10/02/2024, 4:26 AMCommon client side Issues
section?magnificent-oxygen-19823
10/02/2024, 4:27 AMmagnificent-oxygen-19823
10/02/2024, 4:31 AMDO NOT add Access-Contol-*
headers in an attempt to fix a cors issue - it will only make the problem worse as its basically asking the browser to be more strict with its cors protection
• Other standard headers like Authorization
could also cause an issue - we had Basic auth enabled on our staging servers but the ory endpoints did not need it and it can be problematic in preflight OPTIONS
calls
When we fixed our issue i removed Content-Type
and Authorization
; but i have a feeling Content-Type
was still okay - i will re add it and see if the issue persists.magnificent-oxygen-19823
10/02/2024, 4:33 AMlocalhost:3000
the Allowed-Origins
header should specify the port as well; just localhost
will not work.magnificent-oxygen-19823
10/02/2024, 4:36 AMawait fetch('https://$YOUR_BASE_URL/api/.ory/sessions/whoami', {credentials: 'include'}).then((res) => { return res.json() }).then((data) => { console.log(data) })
This was always working for us when we ran it from our browser console while on the whitelisted domain; running it on any other website would fail (correctly)
This will let you know whether the issue is the client or the server; and this command has no headers set.