@obelghiti/gravitee-nodejs-auth-prompt

0.0.1-1 • Public • Published

GRAVITEE-NODEJS-AUTH-PROMPT

What is it

gravitee-nodejs-auth-prompt allow you to authenticate your application in shell mode.

How to use

To import the module

import { checkAuth, getAuthorizationToken } from '@obelghiti/gravitee-nodejs-auth-prompt';
or
const { checkAuth, getAuthorizationToken } = require('@obelghiti/gravitee-nodejs-auth-prompt');

To initialize the configuration

scope is optional bu default is openid email roles

const graviteeConfig = {
  baseUrl: (GRAVITEE_GATEWAY_URL),
  clientDomaine: (GRAVITEE_CLIENT_DOMAINE),
  clientId: (GRAVITEE_CLIENT_ID),
  clientSecret: (GRAVITEE_CLIENT_SECRET)
};

return checkAuth({
  config: graviteeConfig,
  scope: 'openid'
}).then(() => {
  // here you are authenticated
}).catch( error => {
  // here theres is authentication error
  console.error(`Authentication error: ${error.message}`);
});

Explanation of variables:

GRAVITEE_GATEWAY_URL=(url of you gateway)

GRAVITEE_CLIENT_DOMAINE=(domaine of your client)

GRAVITEE_CLIENT_ID=(the client id)

GRAVITEE_CLIENT_SECRET=(the client secret)

Readme

Keywords

Package Sidebar

Install

npm i @obelghiti/gravitee-nodejs-auth-prompt

Weekly Downloads

0

Version

0.0.1-1

License

ISC

Unpacked Size

416 kB

Total Files

10

Last publish

Collaborators

  • obelghiti