【发布时间】:2022-09-30 04:37:22
【问题描述】:
尝试使用flutter_appauth并尝试让它在iOS上注销,但似乎无论我尝试了什么,它都会崩溃。
这是我们的注销代码示例:
var esr = EndSessionRequest(
idTokenHint: idToken,
issuer: \'<ommitted from sample>\',
postLogoutRedirectUrl: \'com.myapp.myapp://login-callback\',
allowInsecureConnections: false,
preferEphemeralSession: true,
serviceConfiguration: <auth endpoint, token endpoint, end session...>,
);
await appAuth.endSession(esr);
同样,对于登录:
final AuthorizationTokenResponse? result =
await appAuth.authorizeAndExchangeCode(
AuthorizationTokenRequest(
<client id>,
\'com.myapp.myapp://login-callback\',
serviceConfiguration: <service config>,
scopes: [...scopes...],
preferEphemeralSession: true,
allowInsecureConnections: false,
),
);
我们在日志中看到了这一点:
2022-09-21 10:47:16.063321-0400 Runner[59528:8189105] [Presentation] Attempt to present <SFAuthenticationViewController: 0x1064d5600> on <SFAuthenticationViewController: 0x106424800> (from <SFAuthenticationViewController: 0x106424800>) whose view is not in the window hierarchy.
2022-09-21 10:48:01.594067-0400 Runner[59528:8189105] No windows have a root view controller, cannot save application state
在 iOS/runner 下,我们的 plist 中有这个:
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.myapp.myapp</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
这似乎在android上运行得很好。 iOS 还需要什么特别的东西吗?
标签: ios flutter oauth keycloak