I am chaining a few requests that return promises. The first one is a login check on some site that returns some credentials back. Then I making a admin.auth().createUser() call. After I know that this createUser call succeeds and that I know the login check succeeded, I want to use these two objects returned from both promises to make a third request to store information in firebase realtime database. I just dont know how to pass both those results to the final promise. Here's some code.
login(siteUser, sitePass)
   .then(credentials => {
      return admin.auth().createUser({
         'email': email,
         'emailVerified': false,
         'password': password,
         'displayName': username
       })
    })
    .then(userData => {
       return writeUserData(userData, credentials); // I need to pass credentials here but I don't know how.
    })
    .then(() => res.status(200).send('success'))
    .catch(err => res.status(500).send(err));
I need to pass the result from the first promise to writeUserData after createUser() resolves.