简体   繁体   English

React Native 与身份服务器的集成

[英]React Native integration with identity server

I have a react native app which is created using react-native-cli.我有一个使用 react-native-cli 创建的 react native 应用程序。

In official react native documentation it recommends to use react-native-app-auth which has too many issues reported.在官方 react native 文档中,它建议使用 react-native-app-auth 报告的问题太多。

However since it's used by many i have started my implementation but came across many issues related Android.然而,由于它被许多人使用,我已经开始实施,但遇到了许多与 Android 相关的问题。

Is there a recommended library that is maintained or tutorial that provides the guide to implement authentication using authorization code flow with PKCE?是否有推荐的库或教程提供使用授权代码流和 PKCE 实现身份验证的指南?

Thanks in advance提前致谢

AppAuth are the official libraries, though they are easier to integrate into a Kotlin based app, since the tech gets quite native in places: AppAuth 是官方库,尽管它们更容易集成到基于 Kotlin 的应用程序中,因为该技术在某些地方非常原生:

  • Opening a Chrome Custom Tab打开 Chrome 自定义选项卡
  • Registering redirect schemes注册重定向方案
  • An Authorization Code Flow redirect授权码流重定向
  • An Authorization Code Grant POST授权码授予 POST
  • A Refresh Token Grant POST刷新令牌授予 POST
  • Secure storage of tokens on the device在设备上安全存储令牌
  • Good login usability良好的登录可用性
  • Handling error and expiry conditions处理错误和到期条件

AppAuth is primarily a pattern though, from RFC8252 , so you could implement the above in Javascript code.不过,AppAuth 主要是一种模式,来自RFC8252 ,因此您可以在 Javascript 代码中实现上述内容。

Start by implementing the above 3 OAuth messages and ensure that you understand payloads.首先实现上述 3 个 OAuth 消息,并确保您了解有效负载。 Post back if you get stuck on areas such as PKCE and I can point you to some relevant JS code.如果您在 PKCE 等领域遇到困难,请回帖,我可以为您指出一些相关的 JS 代码。

TRICKY AREAS棘手的领域

My Android Blog Posts may help you to clarify your requirements and explains some common problems and resolutions.我的Android 博客文章可以帮助您阐明您的需求并解释一些常见问题和解决方案。 There is a detailed code sample you can run locally also.有一个详细的代码示例,您也可以在本地运行。

MOBILE TECH移动技术

I had a React Native sample in the past, but found the tech too painful in some areas:过去我有一个 React Native 示例,但发现该技术在某些方面太痛苦了:

  • Missing error details in responses from React-Native-App-Auth来自 React-Native-App-Auth 的响应中缺少错误详细信息
  • Red screens when tracing HTTPS requests.跟踪 HTTPS 请求时出现红屏。

Therefore I switched everything to Kotlin where there are fewer tech layers to deal with.因此,我将所有内容都切换到了 Kotlin ,那里需要处理的技术层更少。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM