我正在Flutter中构建一个应用程序,并希望使用Keycloak(quay.io/keycloak/keycloak:23.0.1
)登录.
我用docker在本地设置了Keycloak,它工作正常.此外,从应用程序与Keycloak登录工作完美的罚款.
But the Valid redirect URIs was 101 now I want to add a real URI behind it. I added the following line
defaultConfig {
...
manifestPlaceholders += [appAuthRedirectScheme: 'com.example.frontend']
}
in App\frontend\android\app\build.gradle
and in Keycloak I added
但是我得到了错误消息Invalid parameter: redirect_uri
.
我还try 在位于App\frontend\android\app\src\main\AndroidManifest.xml
的Manifest.xml中添加deepLink
<activity
android:name=".MainActivity"
...
<meta-data
android:name="flutter_deeplinking_enabled"
android:value="true" />
<intent-filter>
<data
android:scheme="com.example.frontend"
android:host="frontend" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
但这对我来说仍然不起作用.
我的验证码如下所示:
Future<Credential?> authenticate(
Client client, {
List<String> scopes = const [],
}) async {
try {
var authenticator = io.Authenticator(
client,
scopes: scopes,
port: 4000,
urlLancher: _urlLauncher,
);
return await authenticator.authorize();
} catch (e) {
log("Authorize error: $e");
return null;
}
}
对于身份验证,我使用openid_client: ^0.4.8
,要启动Keyloak,我使用url_launcher: ^6.2.2
.
我也在互联网上搜索了一些链接,但它们对我来说不起作用,也许我错过了一些东西.