Hello everyone! I’m trying out ory keto and I’m a ...
# ory-network
f
Hello everyone! I’m trying out ory keto and I’m a little confused. I can easily connect to my ory network with the keto http client, via project url or my local proxy. But how can I connect via grpc? Is this even supported?
m
Hello @flat-battery-95469 Yes, Ory Keto supports gRPC. The
keto serve
command starts the server and serves both the HTTP REST and gRPC APIs. This command opens the network ports and listens to HTTP and gRPC API requests [source]. To connect to Ory Keto via gRPC, you would need a gRPC client in your preferred programming language. The Ory Keto SDKs, which are generated using the openapi-generator, can be used for this purpose. The SDKs are available for several popular languages including Go, Java, JavaScript, Python, and more [source]. For Go, you can install the gRPC API with the following command:
Copy code
go get <http://github.com/ory/keto/proto|github.com/ory/keto/proto>
And for REST API:
Copy code
go get <http://github.com/ory/keto-client-go|github.com/ory/keto-client-go>
[source] I am not sure if there is a good tutorial for grpc 😬 You can find some community guides here: https://github.com/ory/examples
f
Hey @magnificent-energy-493, thanks for you reply. Not sure if this solves my “problem” though. These tutorials are to use keto with self-hosted, but I’m trying to get this to work with the network permissions client. With the normal http client it works and I can use and manage all permissions in our network. But even if I would use the keto server command to serve as a side-car for our backend, I’d still need a way to connect to our ory network project and I cannot find anything in the docs or config about that
So that’s why I’m wondering if this is even supported.
I connect the https client trough the local tunnel which is connected through our project and in production we obviously use the full project url
But I don’t know how to connect the grpc client to our ory network
So what I’m currently doing is to connect through the “normal” ory client
Copy code
export const createPermissionApi = (basePath: string, apiKey: string) => {
  const permissionApi = new PermissionApi(
    new Configuration({
      accessToken: apiKey,
      basePath,
    }),
  );

  return permissionApi;
};
Now to use the keto client I’d be doing this:
Copy code
import { default as keto } from "@ory/keto-grpc-client";
import { ChannelCredentials } from "@grpc/grpc-js";

export const checkClient = new keto.checkService.CheckServiceClient(
  "???",
  ChannelCredentials.createInsecure(),
);
But what uri am I going to connect to? If I’d go keto serve and use
localhost:4466
how is
keto serve
connected to my ory network project? I cannot find any config for that