title: Node.js grabbing refresh tokens once a session expires FIREBASE
body: <p>I am currently fetching a token, once a user logs in via my express server using the firebase ADMIN SDK. I have been searching high and low for the solution to persist a user's session once it expires after an hour of being logged in.  Is there a way to fetch refresh tokens along with the initial token after a user logs in?  I also would like to note I do not have firebase initialized on my client.  I only have it initialized via the express server where I have my cloud functions.  The cloud function is as follows:</p>
  
  <pre><code>exports.login = (req, res) =&gt; {
    const user = {
      email: req.body.email,
      password: req.body.password
    }
  
    const { valid, errors } = validateLoginData(user)
  
    if (!valid) return res.status(400).json(errors)
  
    firebase
      .auth()
      .signInWithEmailAndPassword(user.email, user.password)
      .then(data =&gt; {
        return data.user.getIdToken()
      })
      .then(token =&gt; {
        return res.json({ token })
      })
      .catch(err =&gt; {
        console.log(err)
        if (err.code === "auth/wrong-password") {
          return res
            .status(403)
            .json({ general: "wrong credentials please try again" })
        }
        return res
          .status(403)
          .json({ general: "wrong credentials please try again" })
      })
  }
  </code></pre>