Is there a sync way to keep track of/get the lates...
# support-questions-legacy
d
Is there a sync way to keep track of/get the latest access token? Atm I'm doing this but it's causing some issues when the session access token payload changes, causing me to perform a request, but the token not being updated yet
Copy code
ts
const authToken = useRef<string | null | undefined>(undefined);
const updateAuthToken = useCallback(async () => {
  if (isServerSide) return;

  const exists = await Session.doesSessionExist();
  if (exists) {
    authToken.current = await Session.getAccessToken();
  } else {
    authToken.current = null;
  }
}, []);
useEffect(() => {
  updateAuthToken();
}, [session]);