Created
December 3, 2018 18:14
-
-
Save astrotars/c6209a2ccfac1384208bf5f8a0616089 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 client = stream.connect(key, secret); | |
module.exports.token = (event, context, callback) => { | |
const data = JSON.parse(event.body); | |
const token = client.createUserSessionToken(data.user); | |
const response = { | |
statusCode: 200, | |
headers: { | |
'Access-Control-Allow-Origin': '*', | |
'Access-Control-Allow-Credentials': true | |
}, | |
body: JSON.stringify({ token: token }) | |
}; | |
callback(null, response); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment