react-native-cookies icon indicating copy to clipboard operation
react-native-cookies copied to clipboard

Example from docs produces error

Open spruce-bruce opened this issue 7 years ago • 4 comments

Copied this example into my project:

CookieManager.setFromResponse(
            'http://example.com',
            'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly')

and it produces this error:

JSON value 'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly' of type NSString cannot be converted to NSDictionary

Versions:

"react-native": "0.52.3",
"react-native-cookies": "^3.3.0",

ios 11.4

spruce-bruce avatar Jul 10 '18 16:07 spruce-bruce

I'm avoiding filing multiple issues because it might all be one dumb setup thing on my part, but I'm having trouble setting cookies at all:

    CookieManager.set({
      name: 'myCookie',
      value: 'myValue',
      domain: 'http://localhost.com',
      origin: 'http://localhost.com',
      path: '/',
      version: '1',
      expiration: '2030-05-30T12:30:00.00-05:00'
    })
      .then( () => CookieManager.get('http://localhost.com') )
      .then(x => console.log(x)); // this line logs an empty object to the console

I don't understand why CookieManager.get('http://localhost.com') is returning an empty object there.

spruce-bruce avatar Jul 10 '18 17:07 spruce-bruce

Copied this example into my project:

CookieManager.setFromResponse(
            'http://example.com',
            'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly')

and it produces this error:

JSON value 'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly' of type NSString cannot be converted to NSDictionary

Versions:

"react-native": "0.52.3",
"react-native-cookies": "^3.3.0",

ios 11.4

https://github.com/joeferraro/react-native-cookies/issues/15

zilan920 avatar Feb 20 '19 03:02 zilan920

Any update on this? Im having the same issue

jamesone avatar Mar 11 '19 17:03 jamesone

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.

safaiyeh avatar Jan 02 '20 19:01 safaiyeh