Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Determine how to handle before_request for gRPC #113

@theacodes

Description

@theacodes

I discovered that I did something totally wrong when I implemented our grpc transport.

All of our HTTP transports call credentials.before_request to get the authorization header populated (here). However, the gRPC transport instead calls credentials.refresh directly and constructs the header itself (here).

I think the gRPC transport needs to do the same as the others, but that's where it gets tricky. before_request takes 4 arguments request, method, url, request_headers. gRPC provides our auth plugin with a context that looks like AuthMetadataContext(service_url='https://pubsub.googleapis.com/google.pubsub.v1.Publisher', method_name='ListTopics'). Does it make sense to call before_request(http_request, context.method_name, context.service_url, headers) even though context.method_name is not an HTTP method? It it okay to overload the term method for different transports?

@dhermes @lukesneeringer thoughts?

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.discussiontriage meI really want to be triaged.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions