Skip to content

Ory Keto access control client for JavaScript and TypeScript

License

Notifications You must be signed in to change notification settings

clayrisser/ory-keto-client

Repository files navigation

ory-keto-client

npm GitHub npm type definitions GitHub stars

Ory Keto access control client for JavaScript and TypeScript

Please ★ this repo if you found it useful ★ ★ ★

Features

  • compatible with typescript
  • supports multiple roles
  • supports custom policies

Installation

npm install --save ory-keto-client

Dependencies

Usage

Import ory-keto-client

import Keto from 'ory-keto-client';

Create keto instance

const { env } = process;
const keto = new Keto(env.KETO_BASE_URL || 'http://localhost:4466');

Create policy

keto.createPolicy({
  description: 'bob is allowed read the blog',
  subjects: ['bob'],
  effect: 'allow',
  actions: ['read']
  resources: ['blog'],
});

Authorize subject

if (await keto.authorizeSubject('bob', 'read', 'blog')) {
  console.log('Authorized');
} else {
  console.log('Not Authorized');
}

Support

Submit an issue

Contributing

Review the guidelines for contributing

License

MIT License

Jam Risser © 2018

Changelog

Review the changelog

Credits

Support on Liberapay

A ridiculous amount of coffee ☕ ☕ ☕ was consumed in the process of building this project.

Add some fuel if you'd like to keep me going!

Liberapay receiving Liberapay patrons

About

Ory Keto access control client for JavaScript and TypeScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published