Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

jaydata with odata provider: withCredentials has no effect #294

Open
andriy-f opened this issue Jul 18, 2017 · 1 comment
Open

jaydata with odata provider: withCredentials has no effect #294

andriy-f opened this issue Jul 18, 2017 · 1 comment

Comments

@andriy-f
Copy link

andriy-f commented Jul 18, 2017

Hi, I'm using JayData with OData provider. An I use code generated by jaysvcutil.
I have noticed that option withCredentials is not propagated to underlying XMLHttpRequest when requesting data.

Code:

        import { factory } from '../services/JayDataContext'
        import { } from 'jaydata/odata'

        factory({
            oDataServiceHost: BACKEND_URL + "/odata",
            withCredentials: true
        })
            .onReady()
            .then(ctx => ctx.SomeEntity.toArray())
            .then(...

            })

The solution is to add change inside jaydata-odatajs (https://github.com/jaystack/olingo-odata4-js).
file: net-browser.js
change:

            if (request.headers) {
                for (name in request.headers) {
                    xhr.setRequestHeader(name, request.headers[name]);
                }
            }
            // Code below was added
            if(request.withCredentials) {
                xhr.withCredentials = true;
            }
@andriy-f
Copy link
Author

andriy-f commented Jul 25, 2017

Nice, the fix (jaystack/olingo-odata4-js@9d52ed6) has been merged already to https://github.com/jaystack/olingo-odata4-js.
But npm doesn't have new version with this fix.
If new version of jaydata-odatajs is published, then all that wold be needed to fix this issue is to update dependency on jaydata-odatajs in projects jaydata and jaydata-dynamic-metadata

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant