Skip to content

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

@ebiggs

Description

@ebiggs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions