mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 21:40:45 +00:00
fix: remove old zitadel client
This commit is contained in:
16
packages/zitadel-client/src/interceptors.ts
Normal file
16
packages/zitadel-client/src/interceptors.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { Interceptor } from "@connectrpc/connect";
|
||||
|
||||
/**
|
||||
* Creates an interceptor that adds an Authorization header with a Bearer token.
|
||||
* @param token
|
||||
*/
|
||||
export function NewAuthorizationBearerInterceptor(token: string): Interceptor {
|
||||
return (next) => (req) => {
|
||||
// TODO: I am not what is the intent of checking for the Authorization header
|
||||
// and setting it if it is not present.
|
||||
if (!req.header.get("Authorization")) {
|
||||
req.header.set("Authorization", `Bearer ${token}`);
|
||||
}
|
||||
return next(req);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user