Closed vinayakyengandul closed 3 years ago
Hi, when you see the 404 error, what url is in the address bar?
Hello, As per the build hosted on IIS, below is the redirect Url http://192.168.0.69:88/loginCallback which is also added in Keycloak's Valid Redirect URIs after login it redirects to the below URL http://192.168.0.69:88/loginCallback#state=337fc704-8f2f-4a16-9d33-5fc53ee354d8&session_state=c0ffeea5-a1fd-487a-84cd-795930d2569a&code=4e4bf19c-2c2d-4608-b7e8-4ceb4186c839.c0ffeea5-a1fd-487a-84cd-795930d2569a.dc846db4-af13-4643-ae21-695419a5598d and gives 404 Error page Url
Screen Shot of 404 error page :-
Okay. What's your flutter version?
This looks like incorrect server configuration. Can you try to access the url directly without the # part of it?
Also, please paste your route settings let me take a look
Yes, the Flutter version : Flutter 2.0.1 • channel beta
Can`t access directly without the # part Same 404 error found. this is the direct url :- http://192.168.0.69:88/loginCallback
Route Setting
initialRoute: '/',
routes: {
'/': (context) => MyHomePage(title: 'Flutter Keycloak demo'),
'/loginCallback': (context) => MyHomePage(title: 'Flutter Keycloak loginCallback'),
},
onGenerateRoute: (routeSettings) {
var uri = Uri.tryParse(routeSettings.name);
if (uri.fragment.startsWith('state')) {
return MaterialPageRoute(
builder: (_) => Center(
child: MyHomePage(title: 'Flutter Keycloak loginCallback1'),
));
}
return MaterialPageRoute(
builder: (_) => Center(
child: Text('Route ${routeSettings.name} not found'),
),
);
},
The issue appears to be from your configuration. I don't know enough about IIS but it seems the traffic going to the callback url is not being sent to your app.
Hi, Any suggestions on keycloak server configuration settings that you can suggest that we can update or change to solve this issue? as implemented solution works when we're running project using simple flutter run command (i.e With localhost).
Hi, I believe its a server configuration issue, not Keycloak.
I don't know much about IIS but you need to forward all requests to that address to your index.html
in your project index.html, ensure you have this line
<base href="/">
On Nginx, it will look something like this
location / { try_files $uri $uri.html $uri/ /fallback/index.html; }
Closing this since no clear next steps. Feel free to reopen
Hello,
I`m using this plugin with same example code when i'm running code normally using the flutter run command flutter run -d chrome --web-port 60000 completed login flow and redirecting back to app after successful login. in this case the redirectURI is http://localhost:60000/loginCallback
but After i build the flutter project and then hosted that build in windows system's IIS, and redirectURI Also changed to the system's IP http://192.168.0.69:88/loginCallback
onGenerateRouting code is taking from issue link :- https://github.com/gibahjoe/keycloak_flutter/issues/1#issuecomment-760256583
in this case after successful login it does not redirect to the hosted app instead it shows the 404 Not-Found error