Build the auth middleware: lazily resolves a credential once via the
provider chain, attaches Authorization: Bearer <token> to every
request, and on a 401 performs exactly one forced refresh + replay
before letting the AuthenticationError surface. Throws
AUTH_NO_CREDENTIALS when the chain yields nothing.
Build the auth middleware: lazily resolves a credential once via the provider chain, attaches
Authorization: Bearer <token>to every request, and on a 401 performs exactly one forced refresh + replay before letting theAuthenticationErrorsurface. ThrowsAUTH_NO_CREDENTIALSwhen the chain yields nothing.