How to get all API permissions on clientside on app loading?

Logic of my app is following. I have all existing permissions of my app in file on frontend as key:value pairs, for centralized control. Then I set permissions for different elements (menu items, random elements) by taking necessary keys from permissions file. The problem is I have to sync full list of API permissions on Auth0 server with my local permissions file each time I add a new permission for some element. I wuld like to do the following. I’ll create saga (React JS) which will load all API permissions from Auth0 server and will save it to localstorage or in redux store. It seems that the only way to do it is using Management API. How exactly is it possible? Can’t find any information on forum.

P.S. It is safe to store those permissions on client side as on client side I just need visually mask some blocks which contents loads from backend API which is protected, and if user has no necessary permissions even if he somehow will set necessary permissions for some elements by hand, he won’t see any contents.

Hi @alt1,

You can get Access Tokens for the Management API for SPAs, but the scope is limited to the current user. Docs: Get Management API Tokens for Single-Page Applications

However, it sounds like you’d like to load all permissions and not just the ones that apply to the current user.

In this case, you could create your own endpoint that communicates with the Management API. The SPA would then call your endpoint to get the permission data.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.