Skip to content

Mikkoun/hm-node-auto-api-explorer

 
 

Repository files navigation

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

Requirements

Getting started

Setting up the project

Clone the project

git clone https://github.com/highmobility/hm-node-auto-api-explorer.git

Open your cloned project folder

cd hm-node-auto-api-explorer

Install dependencies

npm install

Configuration

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_CERTIFICATE and HM_CLIENT_PRIVATE_KEY are 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_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_AUTH_URI and OAUTH_TOKEN_URI can 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 http://localhost:3000/auth/oauth-callback.

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:

npm start

Open http://localhost:3000 in your browser.

Questions or Comments ?

If you have questions or would like to send us feedback, join our Slack Channel or email us at [email protected].

About

☁️ HMKit Node.js sample app for trying out a few Auto API commands

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 59.0%
  • HTML 31.2%
  • CSS 9.8%