Created
March 31, 2020 15:40
-
-
Save decentration/a146c7da1262a30468a1292140945d20 to your computer and use it in GitHub Desktop.
This file contains 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
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