I am having the same issue but using the Strapi helper
If I run the following code from my plugin while BEING LOGGED_IN in admin panel:
import { getFetchClient } from '@strapi/helper-plugin';
const { get } = getFetchClient();
const response = await get('/api/myendpoint');
I do get 401 response and logged-out…
I see in the network tab that the request has bearer token in Auth header