dex: gRPC API: restart as v1 (and use status codes in error returns)

In our gRPC handlers in api.go, we return errors.New("bad something") in a few places. For the callers, it would be more informative if those errors were “proper” gRPC errors, i.e. contained status codes.

See the docs of google.golang.org/grpc/codes for available codes and their meanings.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

As far as the newer api, I worked some on a v1alpha1 api - you can see it https://github.com/venezia/dex/tree/api_v1alpha1 - more to go obviously, but its a stab at it.

I personally use grpcurl and the sister project, grpcui - but I do have to provide the api.proto file … adding reflection shouldn’t impact the program that much (I typically add reflection myself, but we could also make it dependent on an environmental variable)

I’m willing to work on this as I was personally working on add a ListClients grpc call (I added it, but then realized that it wasn’t implemented using k8s as a store, so I’m working on that now) and I personally believe that using the official grpc errors would be best (common errors across all grpc projects)

Furthermore, if we use official grpc errors we might want to re-evaluate the decision to not support grpc-gateway. In conjunction with grpc error codes you will get a reasonably valid HTTP status code For more context see this

There’s also some errors in the documentation about the api (probably outdated) - for example dex will not self generate api certificates if they’re not defined - it will just work in insecure mode. I can clean that up and some other things.

Also updating to a release version of golang/protobuf (and using a protoc that isn’t 2.5 years old) might be nice changes.

Sorry this got long, but I’m willing to help.