A gRPC client for communicating with a Casbin authorization server from Node.js applications. Version 1.0.3 is the current stable release, updated monthly. Provides a comprehensive API to manage policies, roles, and permissions remotely via gRPC, enabling centralized authorization across microservices. Unlike direct Casbin usage with local models, this client delegates enforcement to a remote Casbin server, simplifying policy management in distributed systems. Supports TypeScript definitions and requires a running Casbin gRPC server.
npm install casbin-grpc-client-nodeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows initialization of CasbinClient, starting with constructor options, then calling initializeAdapterAndEnforcer with DB connection and model, then adding a policy and performing an enforce check.
Use grpcHost and grpcPort options instead of host and port.
Call enforce(sub, obj, act) with three string arguments as before (actually not changed). This warning is a placeholder; no known deprecations.
Ensure the Casbin gRPC server is started and reachable at the configured host and port.
Validate model string with Casbin editor before passing to initializeAdapterAndEnforcer.
Start the Casbin gRPC server and verify network connectivity. Check host and port.
Use const { CasbinClient } = require('casbin-grpc-client') or import { CasbinClient } from 'casbin-grpc-client'.Ensure the model string includes required sections like [request_definition], [policy_definition], [policy_effect], [matchers].
Run Casbin migration scripts to create necessary tables, e.g., using Casbin's autoMigrate feature.