Created
December 3, 2017 12:52
-
-
Save jacobandresen/b65cd548ff81a45aeb71c2e8adfd7a03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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