cloudfoundry-identity-admin
v1.2.4
Published
Simplified Cloudfoundry Identity Service calls for javascript
Downloads
8
Maintainers
Readme
cloudfoundry-identity-admin
Simplified Cloudfoundry Identity Service calls for javascript.
Install
Install with npm:
$ npm install cloudfoundry-identity-admin --save
Usage
var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');
API
.checkToken
Checks token for his validity.
Params
endpointUrlCheckToken
{String}: url endpoint.clientId
{String}: client id of corpid service.clientSecret
{String}: client secret of corpid service.token
{String}: token to validate.returns
{Promise}
Example
var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');
cloudfoundryIdentityAdmin.checkToken(
'http://localhost/check_token',
'YOUR_CLIENT_ID',
'YOUR_CLIENT_SECRET',
'TOKEN_TO_VALIDATE'
)
.then((results) => {
//check in results if token valid
})
.catch((error => {
//token not valid
}))
.userinfo
Get userinfo from a usertoken.
Params
endpointUrlUserinfo
{String}: url endpoint.token
{String}: usertoken.returns
{Promise}
Example
var cloudfoundryIdentityAdmin = require('cloudfoundry-identity-admin');
cloudfoundryIdentityAdmin.userinfo(
'http://localhost/userinfo',
'USERTOKEN'
)
.then((results) => {
//check results for userinfo
})
.catch((error => {
//userinfo not found
}))