Skip to content

yawningphantom/identity-node-sdk

 
 

Repository files navigation

identity-node-sdk

Node.js client library for using Identity service.

Getting started

Installation

This library is not distributed on npm. In order to add it as a dependency, run the following command:

$ npm install git+ssh://git@github.com/byjutech/identity-node-sdk.git

Examples

import { identity } from 'identity-node-sdk'

const idOpts = {
  serviceBaseUrl: 'https://identity-staging.tllms.com',
  oauth2: {
    client: {
      id: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
      secret: 'xxx-xxx-xxx'
    },
    auth: {
      tokenHost: 'https://hydra-auth-staging.tllms.com',
      tokenPath: '/oauth2/token',
      revokePath: '/oauth2/revoke',
      authorizePath: '/oauth2/auth'
    },
    // http: { } // wreck options
  },
  scope: 'openid offline identities.read identities.create accounts.create'
}

Find identity

const service = identity(idOpts)
const query = "+xx-xxxxxxxxxx"

const result = await service.find(query)

Get identity

const service = identity(idOpts)
const identityId = "xxxx-xxxxxxxxxx-xxxxxxx-xxxx"

const result = await service.get(query)

Create identity

const service = identity(idOpts)
const request = {
  phone: "+xx-xxxxxxxxxx",
  accounts: [ // Optional
    {
      first_name: "Bruce",
      last_name: "Wayne"
    }
  ]
}

const createRes = await service.create(request)

Add account to identity

const service = identity(idOpts)
const request = {
  first_name: "Jason",
  last_name: "Todd"
}

const createRes = await service.accounts.add(identity_id, request)

About

Client library for Identity service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%