Auto Api Explorer
This project should give you an overview of how to implement High Mobility's OAuth and the HMKit library for working with car data. It consists of two pages: a login page to start the authentication flow, and a dashboard which displays the car's diagnostics state and lets you toggle the door locks.
Table of contents
- Node v8.9.0+
- High mobility developer user account
- Vehicle (with diagnostics and door locks capabilities)
- Cloud app (with diagnostics and door locks permissions)
Setting up the project
Clone the project
git clone https://github.com/highmobility/hm-node-auto-api-explorer.git
Open your cloned project folder
Create a .env config file based on .env.example
cp .env.example .env
You need to configure all 7 missing variables. To do so, log in to the High Mobility developer center. Firstly, you need a cloud app and a vehicle which are linked. The vehicle needs to support diagnostics and door locks capabilities, and the app needs to have permissions for them.
HM_APP_ID- This is displayed on your cloud app's page and is labelled "Serial #". If you do not have a cloud app, create a new one and link it to your vehicle.
HM_CLIENT_PRIVATE_KEYare also displayed at your cloud app's page. You can see Node and REST snippets if you navigate to CLIENT CERITFICATE tab. The certificate and private key that we need are used in Node snippet as HMKit constructor parameters. The first parameter is the client certificate and the second parameter is the private key.
OAUTH_TOKEN_URIcan be found at Team Settings (top right corner dropdown menu) > OAuth Client. Before leaving this page, you also need to configure
REDIRECT URI. You can find the input at the bottom of the page - set it to
Running the server
!! Do not forget to launch your vehicle's emulator in the developer center before running the server. After you have launched the emulator, run the app with this command:
http://localhost:3000 in your browser.