question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CookieManager simple example not working

See original GitHub issue

Hello, I’m trying to set a cookie 🍪 like in the example documentation and I’m getting this error:

WhatsApp Image 2020-06-18 at 18 05 06

My code:

CookieManager.set('http://example.com', {
              name: 'myCookie',
              value: 'myValue',
              domain: 'some domain',
              path: '/',
              version: '1',
              expires: '2015-05-30T12:30:00.00-05:00'
            }).then(done => {
              console.log('CookieManager.set =>', done)
            })

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
safaiyehcommented, Jul 25, 2020

Hi all this ended up being bad documentation.

CookieManager.set('http://example.suba.com', {
  name: 'myCookie',
  value: 'myValue',
  domain: 'suba',
  path: '/',
  version: '1',
  expires: '2015-05-30T12:30:00.00-05:00'
}).then((done) => {
  console.log('CookieManager.set =>', done);
});

The domain attribute needs to be a subdomain of the URL. In the example above, the only valid domains are example or suba. Action item from this issue is to update the docs.

Let me know if this is helpful. The fix I mentioned changed the intended behavior.

4reactions
safaiyehcommented, Jul 13, 2020

Hey all! Apologies for the delay, I’ll be investigating this issue tonight. I believe I know why the issue is there. Will update sometime today

Read more comments on GitHub >

github_iconTop Results From Across the Web

CookieManager simple example not working #59 - GitHub
Hello, I'm trying to set a cookie like in the example documentation and I'm getting this error: My code: ...
Read more >
Android CookieManager setCookie doesn't set anything
I create/get instances of CookieSyncManager and CookieManager at the beginning, and use them throughout the code, instead of creating new ...
Read more >
Android studio cookie manager problem solved - YouTube
CookieManager.getInstance() is not working !!! watch the full video hope your problem will be solved!! Thank you! Please subscribe for more ...
Read more >
Default CookieManager - The Java™ Tutorials
The default CookieManager constructor creates a new CookieManager instance with a default cookie store and accept policy. CookieStore is the place where any ......
Read more >
java.net.CookieManager Class in Java - GeeksforGeeks
A CookieManager is initialized with a CookieStore and a CookiePolicy. ... put() method sets all the applicable cookies, for example, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found