Creating an Admin Dashboard with an existing exposed API

1.Context

  • Trying to build Admin dashboard for our internal use.
  • We have a graphql backend exposed as a resource.
  • It will provide authentication(bearerToken) and also Access Control to our different internal entities.(so won't be using the Retool access control stuff and wont be querying db directly)

2.My Goal

  • Best practices and custom session authentication around admin dashboard
  • Understanding idiomatic way of handling session across multi-page and multi-tab(diffrent stuff in different tab but with same session) dashboard.
    • Session clearing and security stuff.
    • Understanding Idiomatic way of handling multi-page and multi-tab dashboard .
    • Page , global var, auth, local storage and session storage management via reusable function like we do in general react apps

3. Issue:

  • Custom Auth, I am fetching the bearer token and storing it in global var but it does not persist across multiple tabs.
  • Page Management and user context is going out of control and cumbersome
  • Code reusability.

4. Steps I've taken to troubleshoot:

  • Custom Auth, I am fetching the bearer token and storing it in global var but it does not persist across multiple tabs.
  • tried to use sessionStorage and localStorage, I asked ai it told me they are sandboxed??
  • I need to have reusable functions like setToken , getToken, isLoggedIn, Logout and normalize errors
    • kindly provide example on latest version of retool,It will be very nice.
  • Page Management and user context is going out of control and cumbersome
  • There is frequent need to rename page id, Is there any permanent id that we can use to refer to a particular page.
  • Currently I am defining page id in global vars, reusing them
  • I have a single flow from login to dashboard, and I have to add onload to handle sidebar visibility . are there any ways to mitigate this?

Kindly point me in the right direction.

Hi @apoorv-2204,

Thanks for reaching out!

I do not recommend storing bearer tokens in the app state or local storage. The secure and recommended solution is to set up authentication on the resource itself (as our community recommended, here). Since the other topic has progressed further, we can continue the convo there!