Maybe I am wrong but is the issue that a deeper nested component's api call(via hook) is being fired before the app has time to do some part of its authentication process. Meaning you get 401 since you haven't 'timed' some logic concerning the token in the app?
If this is the case, then it's because react builds the app bottom up, in that case the solution for me was to conditionally render the part of the app that requires some state to be set. In my app I simply have a useState(false) that is turned into 'true' by a simple effect.
{someState && <App />}