Cookie auth with AuthSession

I posted this on stack overflow but figured I’d duplicate here.

I read a few places that cookies on the WebBrowser should be shared between fetch requests as well.
I’m using AuthSession to authenticate against our site, which sets a session cookie. It looks like the sessionid cookie is set on the web view that AuthSession shows, but when I go to fetch on the same origin as the login, there are no cookies present.

here’s what my fetch looks like:

return fetch(`${baseApiUrl}/${url}`, {
  method: 'POST',
  credentials: 'same-origin',
  mode: 'same-origin',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    Origin: baseApiUrl
  },
  body: JSON.stringify(body)
});

Am I wrong in thinking that cookies are shared, or is something wrong here?

If I can’t get this working what’s a good alternative?

The project is open source as well:

https://github.com/rit-bikeshare/mobile-app/blob/gd-auth/src/js/api/request.js

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.