Closed fschoell closed 1 year ago
Should be working, needs a bit more testing, but the @substreams/core
library handles adding or not adding authorization based on header requests
import type { Interceptor } from "@bufbuild/connect";
export function createAuthInterceptor(token: string): Interceptor {
return (next) => async (req) => {
if (!req.header.has("Authorization")) {
req.header.set("Authorization", `Bearer ${token}`);
}
return next(req);
};
}
There are cases where an api token is not necessary (internal use for example), so the sink should not enforce this.