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

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

Open xiaohaook opened this issue 6 years ago • 6 comments

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

+[RCTConvert NSDictionary:] RCTConvert.m:55 __41-[RCTModuleMethod processMethodSignature]_block_invoke.135 -[RCTModuleMethod invokeWithBridge:module:arguments:] facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&) facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) _dispatch_call_block_and_release _dispatch_client_callout _dispatch_lane_serial_drain _dispatch_lane_invoke _dispatch_workloop_worker_thread _pthread_wqthread start_wqthread

xiaohaook avatar Dec 30 '18 07:12 xiaohaook

I followed your example and got this error

CookieManager.setFromResponse( 'http://localhost', 'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly') .then((res) => { alert(res) // res will be true or false depending on success. console.log('CookieManager.setFromResponse =>', res); });

xiaohaook avatar Dec 30 '18 07:12 xiaohaook

I ran into the same issue so I use set-cookie-parser, and this works pretty well https://github.com/nfriedly/set-cookie-parser

janet-rivas avatar Jan 22 '19 23:01 janet-rivas

I ran into the same issue so I use set-cookie-parser, and this works pretty well https://github.com/nfriedly/set-cookie-parser

const combinedCookieHeader = res.headers.get('Set-Cookie'); // undefined

What should I do if I can't get a cookie?

UZIhuhuhu avatar Jan 26 '19 03:01 UZIhuhuhu

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

zilan920 avatar Feb 20 '19 03:02 zilan920

@UZIhuhuhu Did u find out how todo this?

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