Hey! These docs are for version 1.0, which is no longer officially supported. Click here for the latest version, 1.1!

Token Request

Oauth Token Request

You must request the token from OAuth as follows. You will need to provide

  • client_id
  • client_secret

These can be obtained via the eDRV dashboard as described in eDRV API Auth

const request = require('request');

const options = {
  method: 'POST',
  url: 'https://auth.edrv.io/oauth/token',
  headers: {
    'content-type': 'application/x-www-form-urlencoded',
  },
  form: {
    grant_type: 'client_credentials',
    client_id: 'S4BTj2Kx8Oe75y64J2QeQ2j2oR1CeDRV',
    client_secret:
      'kLaqFRcvB8AbvRVa1pOgFkkO3j_abeN9D2sf2w79Z4Hb2URfdcNybpRigak0de',
    audience: 'https://api.edrv.io',
  },
  json:true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  let access_token = body.access_token;
  console.log(access_token);
});
{
    "access_token": "YOUR_ACCESS_TOKEN",
    "expires_in": 86400,
    "token_type": "Bearer",
    "scope": "read:x write:y",
}

Please grab the "access_token" above and set it within your application. You will use it to authenticate all API calls to eDRV.

Token Refresh

You can generate a new token post the expiration time using the same request format. Token expiration time is part of the api response("expires_in").

❗️

Never give your Access Token to a third party

Your Access Token can give access to your private Charge Station data and should be treated like a password.


What’s Next

Use your access_token to authorize all eDRV API requests