Storage API not working?

I am trying to use the storage api to persist data across user sessions. I am using it as described in the documentation:‘USER_123456_ROLE’, ‘BASIC_ROLE’);
which returns a success message. However when I then use‘USER_123456_ROLE’);
it always returns value: null. How do I get this working?


Hey Jake! Can you share an example of the code you’re using to set and return the data? Are there any errors being thrown? You’re describing the correct usage of the API, so I’m guessing something else is going on.

By the way, here’s a super simple storage API example I cooked up recently for a product demo. It should give you an example of how to use it: Storage API Example

1 Like


So I did a little more testing, and the example you provided definitely works. I also tested the case within my own app of using getItem immediately after using setItem and it works as well. So clearly the value is getting set, but while I’m in development mode it isn’t persisting across page reloads. Here is my toolbar as I’m developing my dashboard widget:

I remember reading something about how the storage instance is not shared across different apps. Is it possible there is some interaction of the development environment creating a new storage context every time it reloads?

Here is the code I’m using:

export function getUserRoleFromStorage(userId) {
  .then(res => _.get(res, 'data.value'));

export function setUserRole(userId, role) {
  return, role);

export async function getCurrentUser() {
  const currentUser = await getCurrentUserFromApi();
  if (! return {};

  const role = await getUserRoleFromStorage(;

  return { ...currentUser, role };

getCurrentUser gets run every time the app loads up, but always has role = null

Hello! Any update on this? I’m hoping this is a dev only thing, in which case I can build my app expecting the feature to work. But I haven’t had the chance to test it out in “production” yet.