This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Access token #2
Comments
@stygiansabyss did you ever figure this out? |
I did not. I basically abandoned hope at this point. I could not find a feasible way to automate this. |
Could maybe retrieve a token by steering a browser at https://id.getharvest.com/ , automatically clicking the right login buttons and getting the token from the browser url? More info about their new id portal: link. |
@stygiansabyss @mboynes @nilsnh Yes, that works, e.g. like this: console.time("Execution");
const Nightmare = require('nightmare');
const nightmare = Nightmare({ show: false });
const Forecast = require('forecast-api');
const hostUrl = 'https://id.getharvest.com/sessions/new';
const userName = '<Your username>';
const userPassword = '<Your password>';
var userId = '';
var userToken = '';
nightmare
.goto(hostUrl)
.insert('#email', userName)
.insert('#password', userPassword)
.click('#log-in')
.wait('.ember-application')
.url()
.end()
.then(function (result) {
temp = result.split('/');
userId = temp[3];
userToken = 'Bearer ' + temp[5];
console.log(userId);
console.log(userToken);
console.timeEnd("Execution");
})
.catch(function (error) {
console.error('Search failed:', error);
}); |
Forecast now supports authenticating using either Personal Access Tokens or full-fledged OAuth2. Documentation here: http://help.getharvest.com/api-v2/authentication-api/authentication/authentication/ |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Once gathered, it seems as though it can expire. How do you get around this?
The text was updated successfully, but these errors were encountered: