# nodejs-api-server

> Onboarding Api with OAuth and physical button

Latest version **1.0.0** (published 2020-10-26) · 0 weekly downloads

## Install

```sh
npm install nodejs-api-server
pnpm add nodejs-api-server
yarn add nodejs-api-server
bun add nodejs-api-server
```

Provides the command `nexus-www`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-10-26 |
| First published | 2020-10-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 45.2 KB |
| Known vulnerabilities | 0 (+7 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | di98ese |

## Links

- npm: https://www.npmjs.com/package/nodejs-api-server
- npm.io page: https://npm.io/package/nodejs-api-server

## Dependencies (9)

- [bunyan](https://npm.io/package/bunyan.md) 1.5.1
- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [express](https://npm.io/package/express.md) 4.13.1
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.0.0
- [body-parser](https://npm.io/package/body-parser.md) 1.13.2
- [uuid-random](https://npm.io/package/uuid-random.md) ^1.3.2
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1
- [cookie-parser](https://npm.io/package/cookie-parser.md) 1.3.5
- [node-yaml-config](https://npm.io/package/node-yaml-config.md) 0.0.3

## Recent versions

- 1.0.0 (latest) — 2020-10-26

## README

# Auth

Onboarding Api with OAuth and physical button

# How to start it from target GW

1. First you need to locate the IP of your gateway using either your router or scan using avahi-browse

    #> avahi-browse -ar | grep gw2-.* -A3

    This will list all mDNS records that have gw2-<id>
    Look for the ipv4.

2. Transfer the code to target GW

    First check that you can access the gateway with ssh.
    #> ssh root@<gwip>

    There is no password set for root.

    #> cd <onboarding_poc_git>
    #> scp -r nodeJS root@<gwip>:/usr/local/

3. Now all files in the folder nodeJS are located on the gateway filesystem under /usr/local/nodeJS

4. Start the server
    #> ssh root@<gwip>
    root@gw2-0ac3d654c2b4:~# cd /usr/local/nodeJS
    root@gw2-0ac3d654c2b4:~# npm install
    root@gw2-0ac3d654c2b4:~# npm start


# Test server using postman

1. Install postman on the host and start it

3. Then create a GET request with this link:

    http://<gwip>:3000/oauth/authorize?audience=homesmart.local&response_type=code&code_challenge=O7MvFG4EiHPxwqkK8P1gXtHs7WRAahzsgBMmgNMbwLk&code_challenge_method=S256

4. Send it and check the return payload. It Should look like this:

    {
        "auth_code": "<UUID>"
    }

---
_Source: https://npm.io/package/nodejs-api-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
