Hive: Cross Domain Storage

Created on 26 Mar 2021  路  3Comments  路  Source: hivedb/hive

Question

I've used Hive in a couple of production native apps and absolutely love it. Looking to use it in a web project but I have a requirement to store access tokens for multiple domains in one place, eg. dev.com and auth.dev.com and app.dev.com etc all need access to the same storage. Is this possible with Hive?

I know in Javascript this is complicated as cross-domain access to localstorage isn't allowed. One solution is to use an iFrame, which is what cross-storage does. But I'm not sure what the limitations of Hive are and how one would achieve this?

question

All 3 comments

What about using cookies?

@TomasWeg I guess that's an option, but not really a correct use case for cookies. Storing access tokens for a web app is a job for localstorage or something similar. So I guess a better general question would be: is it possible for two different Flutter apps to access the same Hivedb?

No Hive doesn't supports using same database on multiple domains. Because, hive uses IndexedDB for storing data on web. And IndexedDB limits access scope to only current origin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxim-saplin picture maxim-saplin  路  3Comments

aminjoharinia picture aminjoharinia  路  3Comments

rupamking1 picture rupamking1  路  3Comments

NourEldinShobier picture NourEldinShobier  路  3Comments

sergiyvergun picture sergiyvergun  路  4Comments