garrett cox

said
over 1 year ago

Hey Dave,

To check if someone has an Auth token you can check `localStorage.exaptive_access_token`, but it has the chance of being an expired token. And to get the UUID of the user whom the auth token belongs to check `localStorage.exaptive_uuid`.

Hope that helped.

D

Doug Janzen

said
over 1 year ago

Accessing data stored in localStorage by the exaptive client sounds like something that should not be done directly by component authors as it then becomes de facto API and difficult to change later on. Providing an API call to retrieve the currently logged in user would be a better option.

garrett cox

said
over 1 year ago

An API call to retrieve the currently authenticated user exists, but I'm not sure that information is correctly passed to running Xaps outside of our Frontend, nor am I sure if it should be. So making that API call would require the token to be used from local storage.

Edit: I might clarify, we handle sessions using JWT. Currently they are stored in localStorage, but regardless of where they are stored they need to be attached to the request retrieving who is currently authenticated.

Edit 2: I also agree, using local storage is not a viable long term solution, but I think it might be the only way right now.