Skip to content

How to get storage id #4652

Answered by evnchn
BaccanoMob asked this question in Q&A
Apr 23, 2025 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Long story short: app.storage.browser['id']


Test script:

from nicegui import ui, app
import random

@ui.page('/')
def main_page():
    random_10digit = "".join([str(random.randint(0, 9)) for _ in range(10)])
    app.storage.user['random_10digit'] = random_10digit
    ui.label(f"Random 10-digit number: {random_10digit}")
    ui.label(f"Do you find it in /.nicegui/storage-{app.storage.browser['id']}.json ?")

ui.run(storage_secret="Hello")

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@evnchn
Comment options

evnchn Apr 23, 2025
Collaborator

@BaccanoMob
Comment options

@evnchn
Comment options

evnchn Apr 24, 2025
Collaborator

@evnchn
Comment options

evnchn Apr 24, 2025
Collaborator

Answer selected by BaccanoMob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants