Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function setupTestUserJwt({displayName}) {
if (!(process.env.WEBEX_APPID_ORGID && process.env.WEBEX_APPID_SECRET)) {
throw new Error('WEBEX_APPID_ORGID and WEBEX_APPID_SECRET are required to generate guest tokens');
}
return createGuestUser({displayName})
.then(({jwt}) => {
const guestSpark = new CiscoSpark({
credentials: {
federation: true
}
});
return guestSpark.authorization.requestAccessTokenFromJwt({jwt}).then(() =>
// We don't have a user id for guest users until a record is looked up
guestSpark.people.get('me').then((p) => {
const guestUser = Object.assign({}, p);
// id is hydra from get people, but is expected to be a uuid
const {id} = deconstructHydraId(p.id);
guestUser.id = id;
const email = p.emails[0];