0.0.8 • Published 5 years ago

kong-utility-client v0.0.8

Weekly downloads
13
License
ISC
Repository
github
Last release
5 years ago

kong-utility-client

Getting start

npm install --save kong-utility-client

Connect to Kong

import KongClient from 'kong-utility-client'

const kongClient = new KongClient({
  adminURL: 'http://localhost:8001',
  baseURL: 'http://localhost:8000',
  provisionKey: 'some-key'
})

Consumer

Retrieve Consumer

kongClient
  .retrieveConsumer({ name: 'test-kong-client' })
  .then(res => console.log(res.data))

Create Consumer

kongClient
  .createConsumer({ name: 'test-kong-client' })
  .then(res => console.log(res))

Delete Consumer

kongClient
  .deleteConsumer({ name: 'test-kong-client' })
  .then(res => console.log(res))

Credentials

Create Oauth Credentials

kongClient
createOauthCredential({
  consumerName: 'test-kong-client',
  credentialName: 'test-v2',
  redirectURIs: ['http://localhost:3000/test']
})
  .catch(err => console.log(err))
  .then(res => console.log(res))

Get access token

kongClient
  .getAccessToken({
    grantType: 'client_credentials',
    scope: ['USER_ACCESS', 'TMS_ACCESS'],
    authenticatedUserId: 'test-kong-client',
    clientId: 'clientId',
    clientSecret: 'clientSecret'
  })
  .then(res => console.log(res.data))

Refresh access token

kongClient
  .refreshAccessToken({
    refreshToken: 'refresh_token',
    clientId: 'clientId',
    clientSecret: 'clientSecret'
  })
  .then(res => console.log(res))
0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago