Bearer-token authentication. Emits an authorization: Bearer <token> metadata header. The token can be a static string or a (sync or async) callable invoked on every RPC — useful for rotating credentials without reconnecting.
authorization: Bearer <token>
new TokenAuthentication('my-static-token');new TokenAuthentication(async () => await fetchTokenFromIdp()); Copy
new TokenAuthentication('my-static-token');new TokenAuthentication(async () => await fetchTokenFromIdp());
A static bearer token, or a zero-argument callable (sync or async) that returns the current bearer token. The callable is invoked on every RPC.
Produce the authorization metadata header for the next RPC by resolving the token supplier.
authorization
Bearer-token authentication. Emits an
authorization: Bearer <token>metadata header. The token can be a static string or a (sync or async) callable invoked on every RPC — useful for rotating credentials without reconnecting.Example