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

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 #130

Open
xiaohaook opened this issue Dec 30, 2018 · 6 comments

Comments

@xiaohaook
Copy link

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
Copy link
Author

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);
});

@janet-rivas
Copy link

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

@UZIhuhuhu
Copy link

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?

@zilan920
Copy link

#15

@jamesone
Copy link

@UZIhuhuhu Did u find out how todo this?

@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

6 participants