Skip to content
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

authentication example incompatible with grpcurl and grpcui (when token doesn't match) #759

Closed
ebiggs opened this issue Sep 6, 2021 · 1 comment

Comments

@ebiggs
Copy link

ebiggs commented Sep 6, 2021

Bug Report

Version

fresh clone of master, running authentication example's server

Platform

Darwin MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Description

When executing

 grpcurl -v -plaintext -import-path . -proto echo.proto -H 'authorization: Bearer some-secret-token' -d '{ "message": "Hello World" }' localhost:50051 grpc.examples.echo.Echo.UnaryEcho

I get a happy result:

Resolved method descriptor:
// UnaryEcho is unary echo.
rpc UnaryEcho ( .grpc.examples.echo.EchoRequest ) returns ( .grpc.examples.echo.EchoResponse );

Request metadata to send:
authorization: Bearer some-secret-token

Response headers received:
content-type: application/grpc
date: Mon, 06 Sep 2021 00:15:30 GMT

Response contents:
{
  "message": "Hello World"
}

Response trailers received:
(empty)
Sent 1 request and received 1 response

However when I execute this, changing just the token

grpcurl -v -plaintext -import-path . -proto echo.proto -H 'authorization: Bearer not-a-secret' -d '{ "message": "Hello World" }' localhost:50051 grpc.examples.echo.Echo.UnaryEcho

I get this unexpected result:

Resolved method descriptor:
// UnaryEcho is unary echo.
rpc UnaryEcho ( .grpc.examples.echo.EchoRequest ) returns ( .grpc.examples.echo.EchoResponse );

Request metadata to send:
authorization: Bearer not-a-secret

Response headers received:
(empty)

Response trailers received:
(empty)
Sent 1 request and received 0 responses
ERROR:
  Code: Unknown
  Message: OK: HTTP status code 200; transport: missing content-type field

My expectations are to get an "unauthencated" status code and the message: "No valid auth token" per line 66 of tonic/examples/src/authentication/server.rs.

@ebiggs ebiggs changed the title unexpected result from authorization example (when token doesn't match) unexpected result from authentication example (when token doesn't match) Sep 6, 2021
@ebiggs
Copy link
Author

ebiggs commented Oct 7, 2021

Turns out that this isn't an issue in other grpc clients, just grpcurl and grpcui. Haven't tested other Go-lang gRPC clients more broadly. I've abandoned grpcurl now in favor of a home grown cli client written with gRPC-js. This issue may remain as a marker to support grpcurl/grpcui, or it can be closed if that's not a goal.

@ebiggs ebiggs changed the title unexpected result from authentication example (when token doesn't match) authentication example incompatible with grpcurl and grpcui (when token doesn't match) Oct 8, 2021
@ebiggs ebiggs closed this as completed Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant