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

Unable to create Authorization Model using WriteAuthorizatoinModel (grpc) method #1224

Closed
sasanknvs opened this issue Dec 11, 2023 · 4 comments
Labels
question Further information is requested

Comments

@sasanknvs
Copy link

sasanknvs commented Dec 11, 2023

Summary

I am running openfga container on my local machine using postgres. Using postman I am trying to write authorization model using grpc endpoints.

  • Steps to reproduce
    Model an authorization model and try to create it using WriteAuthorizationModel method. Provided the model I am using in the below sections
  • What did you expect to happen?
    Authorization model creation successful and Id in response
  • What actually happened?
    Authorization model failed to create with the an error in the json structure input to the endpoint. I also tried to create same authorization model through a Rest endpoint and I was able to create it. When I try to retrieve it with grpc endpoint I got the response in a different Json structure than the input.

OpenFGA version or commit

If you know it, enter here.

Store data

Below the authorization model I tried to populate to grpc endpoint. The same worked well and am able to create Authorization model successfully with Rest endpoint. I have checked the SDK model classes, they look different from that of the json I am inputting. But I am following the same syntax and configuration language that is specified in the documentation.

{
  "schema_version": "1.1",
  "type_definitions": [
    {
      "type": "user"
    },
    {
      "type": "document",
      "relations": {
        "reader": {
          "this": {}
        },
        "writer": {
          "this": {}
        },
        "owner": {
          "this": {}
        }
      },
      "metadata": {
        "relations": {
          "reader": {
            "directly_related_user_types": [
              {
                "type": "user"
              }
            ]
          },
          "writer": {
            "directly_related_user_types": [
              {
                "type": "user"
              }
            ]
          },
          "owner": {
            "directly_related_user_types": [
              {
                "type": "user"
              }
            ]
          }
        }
      }
    }
  ]
}

Other data

  • How are you running OpenFGA? Docker
  • What datastore are you using? Postgres
  • Are you running OpenFGA with any configuration overrides or with any of the flags mentioned in ./openfga run --help?
  • Do you have any logs or traces that could help us debug the problem? No
@sasanknvs sasanknvs added the bug Something isn't working label Dec 11, 2023
@jon-whit
Copy link
Member

jon-whit commented Dec 11, 2023

@sasanknvs please fill out the section that reports the OpenFGA version you are running with. Without that it's going to be hard to reliably reproduce.

Also, could you share the gRPC request you are making? I see you reported a JSON model. I would expect to see a grpcurl or similar request body. We'll need that to reproduce.

@sasanknvs
Copy link
Author

sasanknvs commented Dec 12, 2023

@sasanknvs please fill out the section that reports the OpenFGA version you are running with. Without that it's going to be hard to reliably reproduce.

Also, could you share the gRPC request you are making? I see you reported a JSON model. I would expect to see a grpcurl or similar request body. We'll need that to reproduce.

I understood the problem. I am using the authorization model in json format from Openfga documentation and using it as a grpc message body. That's why I am seeing the issue. Ideally I should use that json only with Rest endpoint.

Can you let me to know if there is any sdk/client available if I want to communicate with openfga's grpc endpoint ?

@jon-whit
Copy link
Member

jon-whit commented Dec 12, 2023

@sasanknvs our SDKs do not currently support the gRPC endpoint(s). We have gRPC client support in our SDKs in the roadmap. However, the gRPC server of OpenFGA supports the gRPC reflection protocol and various tools like Postman support gRPC and can use the reflection endpoint to generate sample requests.

image

https://learning.postman.com/docs/sending-requests/grpc/grpc-request-interface/ for example

@miparnisari miparnisari added question Further information is requested and removed bug Something isn't working labels Dec 14, 2023
@miparnisari
Copy link
Member

@sasanknvs I'm going to close this. Feel free to open a new issue if you have more questions 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants