New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ts-keycloak-authentication

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-keycloak-authentication

Typescript package for Keycloak authentication

  • 0.0.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ts-keycloak-authentication

Typescript Keycloak authentication package for handling internal service-to-service authentication within Fidel API services using Keycloak.

Installation

You can install the package using npm:

npm install @fidel.uk/ts-keycloak-authentication

Usage

import KeycloakAuthentication, {
  KeycloakAuthenticationConfig,
} from '@fidel.uk/ts-keycloak-authentication';
import { Log } from '@fidel.uk/ts-logger';

// Define your Keycloak configuration
const keycloakAuthenticationConfig: KeycloakAuthenticationConfig = {
  clientId: 'your-keycloak-client-id',
  clientSecret: 'your-keycloak-client-secret',
};

// Create an instance of the logger
const logger = new Log(/* your logger configuration */);

// Create an instance of the KeycloakAuthentication
const authentication = new KeycloakAuthentication(
  keycloakAuthenticationConfig,
  logger,
);

(async () => {
  try {
    const accessToken = await authentication.getAccessToken();
    // console.log("Access Token:", accessToken);
  } catch (error) {
    console.error('Authentication error:', error);
  }
})();

Configuration

The KeycloakAuthentication constructor supports an KeycloakAuthenticationConfig configuration object:

ParameterTypeRequiredDescription
clientIdstringyesThe client ID for your Keycloak client.
clientSecretstringyesThe client secret for your Keycloak client.
keycloakUrlstringnoThe URL of your Keycloak server. If not provided, it defaults to the stage-based URLs: "dev" - https://auth.platform.fidelapi.rocks; "prod" - https://auth.platform.fidelapi.com
realmNamestringnoThe realm name for your Keycloak setup. Defaults to "fidelapi".
stagestringnoThe environment stage, either "dev" or "prod". Defaults to "prod".

Development

Install dependencies

  • Lint: npm ci

Lint

  • Lint: npm run lint
  • Fix: npm run prettier:fix

Test

  • Tests: npm run test
  • Tests with coverage: npm run test:coverage

FAQs

Package last updated on 19 Feb 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