code: function loginFromBrowser (endpoint, config) {
    let uri
  
    switch (endpoint) {
      case AUTH_ENDPOINTS.PRIMARY:
        uri = config.authEndpoint || window.location.origin + window.location.pathname
        break
      case AUTH_ENDPOINTS.SECONDARY:
        uri = config.fallbackAuthEndpoint
        break
    }
  
    return new Promise((resolve, reject) => {
      const xhr = new XMLHttpRequest()
      xhr.withCredentials = true
      xhr.addEventListener('load', () => {
        resolve(xhr.getResponseHeader('user') || null)
      })
      xhr.addEventListener('error', err => {
        reject(err)
      })
      xhr.open('HEAD', uri)
      xhr.send()
    })
  }
docs: Logs in to the specified endpoint from within the browser
  @param {AUTH_ENDPOINTS} endpoint - the endpoint type
  @param {@link module:config-default} config - the config object
  @returns {(Promise<String>|Promise<null>)} the WebID as a string if the
  client cert is recognized, otherwise null.