-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API key to gRPC server and client #394
Conversation
packages/grpc/src/internal/client.ts
Outdated
@@ -86,7 +88,7 @@ export function createGrpcClient<T>( | |||
|
|||
const metaCallback = (_params: any, callback: (arg0: null, arg1: Metadata) => void) => { | |||
const meta = new Metadata(); | |||
meta.add("custom-auth-header", "token"); | |||
meta.add("custom-auth-header", apiKey || DEFAULT_API_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can skip adding the header if there is no API Key provided. Also header name should be "authorization"
meta.add("custom-auth-header", apiKey || DEFAULT_API_KEY); | |
if(apiKey) { | |
meta.add("authorization", apiKey); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the if check a bit earlier
packages/grpc/src/internal/client.ts
Outdated
certPath?: string, | ||
apiKey?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we can turn this into object while this version is still in beta.
option?: {
certPath?: string, | |
apiKey?: string | |
options?: { certPath?: string, | |
apiKey?: string | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a separate interfaces for server and client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either update version to be a breaking change version or just allow support for old and new way.
No description provided.