Created
November 7, 2018 14:10
-
-
Save whtswrng/bd040daaf3fbdea00107646d62f11acc 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
app.post('/v1/login', async (req, res) => { | |
try { | |
const response = await requestPromise.post({ | |
uri: `${API_BASE_URL}/api/oauth2/auth?${req.body.formQuery}`, | |
body: req.body, | |
json: true, | |
strictSSL: false, | |
resolveWithFullResponse: true, | |
simple: false, | |
}); | |
if (response.statusCode === 200) { | |
return res | |
.status(200) | |
.header('set-cookie', loginResponse.headers['set-cookie']) | |
.send(); | |
} else { | |
return res | |
.status(500) | |
.json({ errorMessage: 'An unexpected occured' }); | |
} | |
} catch (error) { | |
return res | |
.status(500) | |
.json({ errorMessage: 'An unexpected error occured' }); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment