Skip to content

Commit

Permalink
docs(readme): auth from api token
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineDao committed Feb 21, 2020
1 parent 9723d82 commit 413a9d4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const pollinationSDK = require('@pollination-solutions/pollination-sdk');

const auth = new pollinationSDK.AuthenticationApi();

const APIToken = {
id: 'some-long-id-string',
secret: 'some-long-secret-string'
}
const apiToken = 'some-long-api-token';

auth.login(APIToken).then(res => {
const owner = 'acme';
const project = 'super-secret-project';

auth.login( { api_token: apiToken} ).then(res => {
const { access_token } = res.data;

const config = new pollinationSDK.Configuration({
Expand All @@ -42,7 +42,7 @@ auth.login(APIToken).then(res => {
const simulations = new pollinationSDK.SimulationsApi(config);

const submitPayload = {
workflow: 'some-long-workflow-uuid',
workflow_slug: 'ladybug-tools/daylight-factor',
inputs: {
parameters: [
{
Expand All @@ -64,7 +64,7 @@ auth.login(APIToken).then(res => {
}
}

simulations.create(submitPayload).then(res => {
simulations.createSimulation(owner, project, submitPayload).then(res => {
console.log(res.data);
}).catch(err => {
console.log(JSON.stringify(err.response.data, null, 2))
Expand Down

0 comments on commit 413a9d4

Please sign in to comment.