Node.js 如何在react native中处理身份验证期间的服务器端错误

Node.js 如何在react native中处理身份验证期间的服务器端错误,node.js,reactjs,react-native,Node.js,Reactjs,React Native,所以我制作了一个应用程序,在这个应用程序中我说登录facebook 对于登录,我使用 这是我的相关代码 loginWithFacebook = async () => { const redirectUrl = await Linking.getInitialURL() const authUrl = config.backendUrl + '/auth/facebook' Linking.addEventListener('url', this.handleRed

所以我制作了一个应用程序,在这个应用程序中我说登录facebook

对于登录,我使用

这是我的相关代码

loginWithFacebook = async () => {
    const redirectUrl = await Linking.getInitialURL()
    const authUrl = config.backendUrl + '/auth/facebook'
    Linking.addEventListener('url', this.handleRedirect)
    try {
        const authResult = await WebBrowser.openAuthSessionAsync(authUrl, redirectUrl)
        console.log(authResult)
        Linking.removeEventListener('url', this.handleRedirect)
    } catch (err) {
  console.warn('ERROR:', err)
}
}
虽然这样做有效,但我的问题在于错误处理,我在后端(NodeJS)上使用passport Js。成功验证后,我将重新定向到我的深度链接url

  return res.redirect(myapplink://)
目前,在出现错误时(比如说有一个sql连接错误),我抛出了一个500内部错误

return res.status(error.status).send(error.message)

由于与身份验证相关的事件通常是使用
href
完成的,而不是使用ajaxy请求,因此在这种情况下,您通常如何处理错误?我认为应用程序和web的答案应该是相同的,但如果不是,请您建议我如何处理应用程序和web中的错误

不确定是否最佳,但可能使用EJS?也许其他人可以建议一种更好的方法当身份验证失败时,期望的行为是什么?如果你正在使用expo,为什么不直接使用expo的facebook和google模块?如果你没有使用expo和plain RN,那么就选择firebase@Nick用于身份验证的模式web浏览器关闭,并显示抛出的错误?(在error.message中)未使用expo,并且不希望使用Firebase,因为我希望允许用户使用其个人资料和营销Api范围连接多个帐户