Skip to content

Instantly share code, notes, and snippets.

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 decentration/a146c7da1262a30468a1292140945d20 to your computer and use it in GitHub Desktop.
Save decentration/a146c7da1262a30468a1292140945d20 to your computer and use it in GitHub Desktop.
const options = {
url: 'https://api.knack.com/v1/applications/5e159b77ed2cc100162fae1f/session',
method: 'POST',
headers: {
'content-type': 'application/json',
'Knack-Application-Id': '5e159b77ed2cc100162fae1f',
'email': bundle.authData.email,
'password': bundle.authData.password
},
params: {
'email': bundle.authData.email,
'password': bundle.authData.password
},
body: {
'email': bundle.authData.email,
'password': bundle.authData.password
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = z.JSON.parse(response.content.token);
//const token = z.JSON.parse(reponse.content.token)
// const token=
// You can do any parsing you need for results here before returning them
return {
'sessionKey': results.token
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment