/keycloak-request-token

Primary LanguageJavaScriptApache License 2.0Apache-2.0

keycloak-request-token

Coverage Status Build Status Known Vulnerabilities dependencies Status

NPM

A simple module to request an Access Token from a Keycloak Server.

Project Info
License: Apache-2.0
Build: make
Documentation: http://bucharest-gold.github.io/keycloak-request-token/
Issue tracker: https://github.com/bucharest-gold/keycloak-request-token/issues
Engines: Node.js 4.x, 6.x, 7.x

Installation

npm install keycloak-request-token -S

Usage

'use strict';

const tokenRequester = require('keycloak-request-token');

const baseUrl = 'http://127.0.0.1:8080/auth';
const settings = {
    username: 'admin',
    password: 'admi',
    grant_type: 'password',
    client_id: 'admin-cli'
};

tokenRequester(baseUrl, settings)
  .then((token) => {
    console.log(token);
  }).catch((err) => {
    console.log('err', err);
  });

Contributing

Please read the contributing guide