A 401 would indicate you’re not using an authentication token, or the token you’re using lacks the required scope.
So can you make sure you’re using a token with the analytics:read:games scope and granted by the developers for the game you’re attempting to get analytics data for.