Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@keycloak/keycloak-admin-client

Package Overview
Dependencies
Maintainers
4
Versions
253
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keycloak/keycloak-admin-client

A client to interact with Keycloak's Administration API

  • 26.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @keycloak/keycloak-admin-client?

@keycloak/keycloak-admin-client is an npm package that provides a client for interacting with the Keycloak Admin REST API. It allows developers to manage Keycloak resources such as users, groups, roles, and clients programmatically.

What are @keycloak/keycloak-admin-client's main functionalities?

User Management

This feature allows you to manage users in Keycloak. The code sample demonstrates how to authenticate with Keycloak and create a new user in a specified realm.

const KcAdminClient = require('@keycloak/keycloak-admin-client');
const kcAdminClient = new KcAdminClient();

async function createUser() {
  await kcAdminClient.auth({
    username: 'admin',
    password: 'admin',
    grantType: 'password',
    clientId: 'admin-cli'
  });

  const user = await kcAdminClient.users.create({
    realm: 'myrealm',
    username: 'newuser',
    enabled: true
  });
  console.log('User created:', user);
}

createUser();

Group Management

This feature allows you to manage groups in Keycloak. The code sample demonstrates how to authenticate with Keycloak and create a new group in a specified realm.

const KcAdminClient = require('@keycloak/keycloak-admin-client');
const kcAdminClient = new KcAdminClient();

async function createGroup() {
  await kcAdminClient.auth({
    username: 'admin',
    password: 'admin',
    grantType: 'password',
    clientId: 'admin-cli'
  });

  const group = await kcAdminClient.groups.create({
    realm: 'myrealm',
    name: 'newgroup'
  });
  console.log('Group created:', group);
}

createGroup();

Role Management

This feature allows you to manage roles in Keycloak. The code sample demonstrates how to authenticate with Keycloak and create a new role in a specified realm.

const KcAdminClient = require('@keycloak/keycloak-admin-client');
const kcAdminClient = new KcAdminClient();

async function createRole() {
  await kcAdminClient.auth({
    username: 'admin',
    password: 'admin',
    grantType: 'password',
    clientId: 'admin-cli'
  });

  const role = await kcAdminClient.roles.create({
    realm: 'myrealm',
    name: 'newrole'
  });
  console.log('Role created:', role);
}

createRole();

Client Management

This feature allows you to manage clients in Keycloak. The code sample demonstrates how to authenticate with Keycloak and create a new client in a specified realm.

const KcAdminClient = require('@keycloak/keycloak-admin-client');
const kcAdminClient = new KcAdminClient();

async function createClient() {
  await kcAdminClient.auth({
    username: 'admin',
    password: 'admin',
    grantType: 'password',
    clientId: 'admin-cli'
  });

  const client = await kcAdminClient.clients.create({
    realm: 'myrealm',
    clientId: 'newclient',
    enabled: true
  });
  console.log('Client created:', client);
}

createClient();

Other packages similar to @keycloak/keycloak-admin-client

FAQs

Package last updated on 03 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc