Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter appauth Invalid parameter: redirect_uri

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'
  ]

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);

I was also trying different configs on keycloak side: enter image description here

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

enter image description here

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

like image 402
Maciej Avatar asked Sep 17 '20 16:09

Maciej


1 Answers

The problem with your code is that your applicationId and appAuthRedirectScheme contains '_' character which is invalid for an URL, so I would suggest to change app package name to not contain capitalized or other characters other than '.', and it should work

like image 181
Edi Avatar answered Oct 22 '22 13:10

Edi