https://authzed.com logo
#spicedb
Title
# spicedb
i

Igor.Shmukler

09/13/2022, 3:04 AM
i am still unable to get NodeJS client do what I need. zed is working. I call it as:
zed permission check event:27 read user:2
and it returns
true
. that is perfect for me. following the example @Joey recommended, I was able to initialize the client. I don't get error, yet it is not working like
zed
. my code:
Copy code
const eventRef = v1.ObjectReference.create({
        objectType: 'event',
        objectId: `${id}`
      });
      const userRef = v1.ObjectReference.create({
        objectType: 'user',
        objectId: `${userId}`
      });
      const checkPermissionRequest = v1.CheckPermissionRequest.create({
        resource: eventRef,
        permission: 'read',
        subject: v1.SubjectReference.create({
          object: userRef
        })
      });
      spiceDBclient.checkPermission(checkPermissionRequest, (err, response) => {
        console.log('response:', response);
        console.error(err);
      });
The respond I am getting is not a
true
or
false
. It reads like:
{ permissionship: 2, checkedAt: { token: 'GgQKAjMx' } }
What am I doing wrong? What is the correct what of getting what I need?