0.0.2342 • Published 2 months ago

@braustin-holdings/homebase-node-sdk v0.0.2342

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

homebase-node-sdk

A node SDK for interacting with braustin-holdings/homebase. Provides an authenticated for the Homebase React Client.

Installation

npm i @braustin-holdings/homebase-node-sdk

Usage

Instantiate a new HomeBaseSDK object by passing it your app's clientId and clientSecret.

const HomeBaseSDK = require('@braustin-holdings/homebase-node-sdk')
const hb = new HomeBaseSDK('CLIENT_ID_HERE', 'CLIENT_SECRET_HERE')

Authentication with Homebase

There are two ways of obtaining a JSONwebtoken to gain access to the Homebase data. Choose whichever is most convenient for your app.

The getAuthToken method

For use in your controllers or scripts.

const tokenData = await hb.getAuthToken()
console.log(tokenData) // { token: '39fp...', graphqlUrl: 'https://homebase-api.herokuapp.com' }

As an Express middleware

If you're using express and the HomeBase React Client, you can easily obtain the token by including this middlware. NOTE you will want this to be one of the earlier middleware in the chain.

The Homebase React Client looks for the url used in the middelware.

const app = express()

app.use(hb.middleware.getAuthToken) // res.json({ token: '39fp...', graphqlUrl: 'https://homebase-api.herokuapp.com' })
0.0.2342

2 months ago

0.0.2341

6 months ago

0.0.2340

1 year ago

0.0.2339

2 years ago

0.0.229

2 years ago

0.0.230

2 years ago

0.0.234

2 years ago

0.0.232

2 years ago

0.0.231

2 years ago

0.0.227

2 years ago

0.0.226

2 years ago

0.0.225

2 years ago

0.0.224

2 years ago

0.0.228

2 years ago

0.0.223

2 years ago

0.0.222

2 years ago

0.0.21

2 years ago

0.0.2

2 years ago

1.0.0

2 years ago