Skip to content

Instantly share code, notes, and snippets.

@astrotars
Created December 3, 2018 18:14
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 astrotars/c6209a2ccfac1384208bf5f8a0616089 to your computer and use it in GitHub Desktop.
Save astrotars/c6209a2ccfac1384208bf5f8a0616089 to your computer and use it in GitHub Desktop.
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