Flutter appauth Invalid parameter: redirect_uri

Mac*_*iej 5 keycloak flutter appauth

I have local instance of keylcoak and I am trying to connect my flutter app to it and for that I am following the this tutorial but I got stuck on this redirect_uri issue.

In android's build.gradle I have added the following piece to default config:

  applicationId = 'com.my.example_app'
  manifestPlaceholders = [
        'appAuthRedirectScheme': 'com.my.example_app'
  ]
Run Code Online (Sandbox Code Playgroud)

In the code I have:

    const REDIRECT_URI = 'com.my.example_app://login-callback';
    //some code in between
    final AuthorizationTokenRequest req = AuthorizationTokenRequest(
    CLIENT_ID,
    REDIRECT_URI,
    allowInsecureConnections: true,
    issuer: ISSUER,
    discoveryUrl: DISCOVERY_URL,
    scopes: SCOPES);
    final AuthorizationTokenResponse result = await appAuth.authorizeAndExchangeCode(req);
Run Code Online (Sandbox Code Playgroud)

I was also trying different configs on keycloak side: 在此处输入图片说明

So when I press login and it redirects me to the keycloak page but all I see is:

在此处输入图片说明

Does anyone know what is the proper redirect uri value here?

Edi*_*Edi 4

您的代码的问题是您的 applicationId 和 appAuthRedirectScheme 包含“_”字符,该字符对于 URL 无效,因此我建议更改应用程序包名称,使其不包含大写或“.”以外的其他字符,并且它应该可以工作