Skip to content

Instantly share code, notes, and snippets.

@jacobandresen
Created December 3, 2017 12:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobandresen/b65cd548ff81a45aeb71c2e8adfd7a03 to your computer and use it in GitHub Desktop.
Save jacobandresen/b65cd548ff81a45aeb71c2e8adfd7a03 to your computer and use it in GitHub Desktop.
/*jshint esversion: 6 */
require('dotenv').config();
var axios = require('axios');
const getToken = () => {
const sessionEndpoint = 'https://api.etilbudsavis.dk/v2/sessions';
return new Promise(function (fullfill, reject) {
axios.post(sessionEndpoint, {
api_key: process.env.API_KEY,
token_ttl: 256,
client_id: process.env.CLIENT_ID,
email: process.env.EMAIL,
password: process.env.PASSWORD
}).then( function(response) {
fullfill(response.data.token);
}).catch( function(response) {
reject(-1);
});
});
};
const offerSearch = () => {
};
getToken().then(function(token) {
console.log(token);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment