@obelghiti/gravitee-nodejs-auth-prompt
v0.0.1-1
Published
authenticate user with prompt
Downloads
14
Readme
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)