在 IOS 中用自定义 SFSafariViewController 替换 AppAuth

Posted

技术标签:

【中文标题】在 IOS 中用自定义 SFSafariViewController 替换 AppAuth【英文标题】:Replacing AppAuth with custom SFSafariViewController in IOS 【发布时间】:2021-01-27 18:59:43 【问题描述】:

我想用自定义 SFSafariViewController 替换 appauth 以进行登录并从 web 获取令牌。任何人都可以通过一些示例或教程帮助我如何继续此操作。

由于我是 ios 开发的初学者,我不知道从哪里开始。谢谢。

AppAuth - https://github.com/openid/AppAuth-iOS

【问题讨论】:

【参考方案1】:

登录不是在 SFSafariViewController 中执行的,而是在 ASWebAuthenticationSession 中执行的。无法覆盖 ASWebAuthenticationSession 的 Safari 视图(这是一项操作系统功能)。

如果您自己在自定义 SFSafariViewController 中实现 OpenID 流,则需要在 info.plist 文件和 AppDelegate 中声明回调 URL。它会更不安全,也更不友好。

【讨论】:

以上是关于在 IOS 中用自定义 SFSafariViewController 替换 AppAuth的主要内容,如果未能解决你的问题,请参考以下文章

iOS MJRefresh 自定义刷新动画

iOS MJRefresh 自定义刷新动画

iOS MJRefresh 自定义刷新动画

如何在 WPF 自定义装饰器中用线条排列拇指

无法在 Spring Security 中用自定义替换标准登录表单

在 Qt Creator Designer 中用自定义模板小部件替换小部件