function encodeState(stateObject = {}) {
  // this filters out nonce, code_verifier, and max_age from the state object so that the values are
  // only stored in its dedicated transient cookie
  const { nonce, code_verifier, max_age, ...filteredState } = stateObject; // eslint-disable-line no-unused-vars
  return base64url.encode(JSON.stringify(filteredState));
}
Prepare a state object to send.

@param {object} stateObject

@return {string}