# Persisting device fingerprint specific states specific to a client

**URL:** <https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981>\
**Category:** Custom Components\
**Created:** [August 17, 2020, 9:31am UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981 "2020-08-17T09:31:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GokulNC](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/gokulnc/32/2806_2.png) [@GokulNC](https://discuss.streamlit.io/u/GokulNC)\
**Post date:** [August 17, 2020, 9:31am UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981/1 "2020-08-17T09:31:44Z")

</div>

Though there are ways to store a single session’s states (like [this](https://discuss.streamlit.io/t/multi-page-app-with-session-state/3074/)), there currently seems to be no way to persist them across refreshes for a single user/client. (Something roughly like a browser cookie or local storage)

Not to be confused with a global persistent states (like [this](https://discuss.streamlit.io/t/simple-example-of-persistence-and-waiting-for-input/2111) or [this](https://discuss.streamlit.io/t/multi-page-app-with-session-state/3074/35)).

It would be great if we could use the `device fingerprint` of the client to store a state object specific to that client.  
Would that be possible?

---

<div class="post-metadata">

**Author:** ![andfanilo](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/andfanilo/32/1040_2.png) [@andfanilo](https://discuss.streamlit.io/u/andfanilo)\
**Post date:** [August 17, 2020, 9:45am UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981/2 "2020-08-17T09:45:45Z")

</div>

> [@GokulNC](#):
>
> It would be great if we could use the `device fingerprint` of the client to store a state object specific to that client.

I’m currently testing [fingerprintjs2](https://github.com/fingerprintjs/fingerprintjs2) for device fingerprinting, we could put that in a Streamlit component to send back browser data to the Streamlit server and hack the state implementation a bit to store device fingerprints instead of session ID.

But given the security policy of the component’s IFrame I’m not sure this library will be able to collect _all_ of the device information it needs to create a decent fingerprint (and I’m actually happy with this. From a user perspective, even if it’s for a small Streamlit app, there may need to be some form of acceptance from the user to be tracked by device. Being prevented from running arbitrary JS helps frame the question of user data collection better).

Best way is to try now 😉

---

<div class="post-metadata">

**Author:** ![GokulNC](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/gokulnc/32/2806_2.png) [@GokulNC](https://discuss.streamlit.io/u/GokulNC)\
**Post date:** [August 17, 2020, 9:48am UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981/3 "2020-08-17T09:48:12Z")

</div>

Great! Thanks a lot. 🙂  
Please do update here on how it goes after you try it out.

---

<div class="post-metadata">

**Author:** ![andfanilo](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/andfanilo/32/1040_2.png) [@andfanilo](https://discuss.streamlit.io/u/andfanilo)\
**Post date:** [August 17, 2020, 10:10am UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981/4 "2020-08-17T10:10:53Z")

</div>

Yeah hopefully someone tries before me as I’ve got other things to do 🙂 you can eventually try running the [code snippet](https://github.com/fingerprintjs/fingerprintjs2#usage) in `components.html` and see what happens

---

<div class="post-metadata">

**Author:** ![dormeir999](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/dormeir999/32/5523_2.png) [@dormeir999](https://discuss.streamlit.io/u/dormeir999)\
**Post date:** [March 25, 2021, 9:50am UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981/5 "2021-03-25T09:50:44Z")

</div>

Would love to see a fingerprint/cookie solution as well 🙂

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [May 13, 2022, 8:56pm UTC](https://discuss.streamlit.io/t/persisting-device-fingerprint-specific-states-specific-to-a-client/4981/6 "2022-05-13T20:56:34Z")

</div>


