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.

Enable cookie support after the SDK has been initialized

See original GitHub issue

We have a home page / with a cookie banner. We are not allowed to write cookies until the user consents. We initialize the SDK with isCookieUseDisabled=true. Once the user consents, we would like to immediately write the cookies so when they continue to the next page /sign-in, same session ID is used there.

We can call appInsights.properties.context.sessionManager.update() but there seems to be no way to set CoreUtils._canUseCookies to true once the SDK has been initialized.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
MSNevcommented, Mar 17, 2021

As part of the change that was just checked in, I’ve added some documentation on the readme but I thought here would also be a good location. Moving forward, cookie support will be based on the appInsights instance so enabling disabling after initialization will be simply a case of using. appInsights.getCookieMgr().setEnabled(value: boolean)

I’ve added support for the existing _canUseCookies, but usage is problematic in ES3 environments (won’t always work) and it’s still also global, so if you share an environment with another instance using this will affect other users. And for backward compatibility, disabling via this will still disable globally – even for instance based cookies

2reactions
markwolffcommented, Oct 17, 2019

Seems like a bug. Will get this in to next release (2.3.1)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cookies and Storage for Web - Braze
To disable all cookies, use the noCookies option when initializing the Web SDK. Disabling cookies will prevent you from associating anonymous users who...
Read more >
Facebook JavaScript SDK does not set access token cookie in ...
After the FB.login method is called, I'm able to retrieve the access token from Facebook, but it's not setting the access token and...
Read more >
Updating analyticsEnabled after SDK initialization
I am trying to implement the MarketingCloudSDK for our iOS app and have a question about initialization of the SDK.
Read more >
Manage Session Cookies | Firebase Authentication
Session cookie verification requires the Admin SDK to be initialized with a project ID. This happens automatically when you initialize the SDK with...
Read more >
Setting an identity (Required) - Zendesk Developer Docs
Note: The Zendesk Support SDK is intended for end-users only. ... you may want to initialize the SDK with an empty identity when...
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