如何通过 React 网页对 React Native 用户进行身份验证?

How to authenticate React Native user by React Web page?

在我们公司,我们决定不为 React WebReact Native 使用单独的 Login/Register/ChangePassword 表格,我们宁愿制作一次 React Web 表格并重复使用它们在 React Native 中。

这意味着本机应用程序的用户单击 Login 按钮并打开默认浏览器进行登录。成功登录后,用户将被重定向回已登录的本机应用程序。

我认为这在 Hybrid Native 应用程序中很常见,但我没有找到任何文档如何在 React Native 中实现这一点。

谁能帮我举个简单的例子,或者把我重定向到一些 docs/post?

您可以使用 react-native-webview 打开公司登录 url,并将注入的 Javascript 道具传递给 WebView 组件,当用户登录时,您将获得包含用户数据的元素(例如:getElementById ("userName")) 并关闭 WebView 将用户重定向回应用程序。

Extra Information here;

WebView props here让你知道如何控制它。