Skip to content

Instantly share code, notes, and snippets.

@dbouwman
Created July 9, 2017 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbouwman/a077bcd28522a1b195629b8f359d7622 to your computer and use it in GitHub Desktop.
Save dbouwman/a077bcd28522a1b195629b8f359d7622 to your computer and use it in GitHub Desktop.
bits and pieces
/**
* Given a username and password, make a https request for a token
*/
getToken (username, password, portalBaseUrl) {
const url = `${portalBaseUrl}/sharing/rest/generateToken?f=json`;
let options = {
method: 'POST',
form: {
username: username,
password: password,
referer: portalBaseUrl
},
json: true
};
// fire the request
return request.post(url, options);
}
/**
* Proxy to the fetch that is imported during the build process
*/
fetch (url, options) {
return fetch(url, options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment