Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Blank object for cookie (Android) #141

Open
Noitidart opened this issue Apr 21, 2019 · 2 comments
Open

Blank object for cookie (Android) #141

Noitidart opened this issue Apr 21, 2019 · 2 comments

Comments

@Noitidart
Copy link

Noitidart commented Apr 21, 2019

I'm on Android. I have the following code:

const res = await fetch('http://localhost:1337/user/me');
console.log('set-cookie:', res.headers.get('set-cookie')); // logs "sails.sid=s%3A6RiJhdKbjT9fkF7Ydozik61MCtmjcLCD.WyT8fXThP0C0Vqay86cmeD4Tn5Wl4aiJ1oFCo0HMRcQ; Path=/; HttpOnly"
console.log('get cookie:', CookieManager.get('http://localhost:1337')); // logs empty object {}

Does anyone know why I'm getting an empty object? The fetch did definitely succesfully set the cookie as I can do other calls after this first fetch.

@Noitidart Noitidart changed the title Blank object for cookie Blank object for cookie (Android) Apr 21, 2019
@VladyslavKochetkov
Copy link

They are actually async calls so you have to handle them as such

@safaiyeh
Copy link

safaiyeh commented Jan 2, 2020

I have forked the repo here: https://github.com/safaiyeh/react-native-cookie-store
We can create issues and PRs there to continue the development of the project.

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

3 participants