Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    James Clancey
    Really easy to throw those in

    Got some info that I'd like to share regarding the Keycloak logout problem. As @Clancey said, it was indeed because of the cookies, but due to the native safari and android implementation, it is impossible to manipulate them programatically without implementing a Webview. Though, in the case of Keycloak, the end session endpoint actually works, despite me suggesting otherwise above. In the case of Keycloak, here is the logOut() method implementation:

      Future<http.Response> logout() async {
        final response = await KC_OAuth.httpClient.post(
            headers: await getAuthHeaders(),
            body: {
              'client_secret': KC_OAuth.authenticator.clientSecret,
              'client_id': KC_OAuth.authenticator.clientId,
              'refresh_token': KC_OAuth.currentOauthAccount.refreshToken
        return response;

    I was mistakenly calling it as a GET, when it was instead a POST. As you can see, it requires the token in the header and client_secret, client_id, refresh_token in the body.
    Hope this helps you guys out. I'll look forward to making this all, including the provider into a pull request.

    Also, for those looking to implement a way to clear cookies in the Webview(WebAuthenticatorActivity for Android) and maybe make it into a PR, have a look here: https://stackoverflow.com/a/31950789
    Hi @CatalinBoiangiu, do you have any route with the name '/redirect' or something else because I don't get the redirect. Thanks in advance
    PS: I'm new here
    Marko Divjak
    @isgj_gitlab first check in manifest if you have defined scheme : <data android:scheme="com.me.myapp" />
    Then you should add ( for this scheme ) redirect "com.me.myapp://redirect" and in Keycloak for redirect com.me.myapp://* and it should work
    @Mjafko thank you, i defined the scheme in the wrong file
    Marko Divjak
    @isgj_gitlab no problem :-) glad I could help ya.
    Hi there anyone of you is having problems with the redirect in samsung devices with a default browser?
    Actually that's an issue Clancey/simple_auth#101
    Alban Zeka
    hi all
    can anyone point me to a GitHub example that has token authentication with azure ad or oauth2?
    Federico Grosso
    Hi! I am trying to authenticate with Azure AD using simple_auth_flutter, but I am having a problem with the redirect on android. If I use the client secret, the app uses a WebView instead of the browser and the redirect is not handled ok throwing ERR_UNKNOWN_URL_SCHEME. If the secret is not set, the redirects is handled correctly. Is there a way to handle custom schemes of simple_auth_flutter using client secret?
    James Clancey
    You have to register the redirect with azure
    Federico Grosso
    I have registered the redirect in Azure (Home > App registrations > My App - Authentication) Redirect URIs - Public client. The redirect is working correctly when I have no Client Secret (it opens the default device browser), but when I added one Client Secret it uses an internal WebView, which can not handle the custom scheme (which is defined in the Manifest)
    James Clancey
    If you use the internal you can use any redirect, like localhost
    Manifest is only used when you use the external browser
    Can anyone help me? I use simple_auth_flutter and use useEmbeddedBrowser = true but the window to login does not close after successful login. The .authenticate() method returns an OAuthAccount object with a token, but the window does not go away.
    Assane Dessables
    @puhtze maybe you have to explicitly close in the callback?
    Possible. But how? I also do remember seeing this closing by itself. Maybe the latest Flutter Version broke it?
    @puhtze maybe your app is in debug mode? Try the release mode.
    Marko Divjak
    how you handle refresh tokens with Keycloak?
    vinay reddy vankayala
    @Clancey simple_auth_flutter Azure login for android is not redirecting after login. Sample app in the github is also not working. Can you look into it. Thanks.
    @VankayalaReddy_twitter how far did you get with your authentication with Azure. I'm really struggling to get it to work
    What should the redirect be setup as? I'm missing the point of the redirect? I'll be connecting from an app

    I'm trouble with the redirection from azure and facebook api's too @klops-za .
    I tried several ways to configure the return route path from facebook developers and azure active directory configuratiions, but with no results. On the facebook for example, i don't see any option to set the uri in another pathern that no use the http:// protocol. And in the azure, after a pre configuration, the server generate a uri pattern with the prefix msauth://, followed to the application package and an identifier code. But in the simple auth activity, even if I change the data tag to accept the appropriate standards, the login is still not redirected to the application.

    I try use the simple_auth_flutter 2.0.4 in my own application and after some tests, i use directly on the git hub example code. The example with the google api worked perfectly. I even created another application of my own on google developers, and it also worked. But as stated above, I encounter problems with facebook and azure apis.


    @CatalinBoiangiu Thanks for posting the sample auth helper. I am a Flutter novice so some of my questions maybe obvious for some of you here. I have a form (below) I like to call the helper class to authenticate Keycloak bearer only. I am sure I set up the URLs, client id and secret correct since I can bearer authenticate using Java with the same values.

    Map<String, String> getAuthHeaders() {
    return {'Authorization': 'Bearer ${KC_OAuth.currentOauthAccount.token}'};
    the value currentOauthAccount is null
    onPressed: () {
    child: Text(
    color: Colors.blueAccent,
    textColor: Colors.white,

    E/flutter ( 4156): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'token' was called on null.
    E/flutter ( 4156): Receiver: null
    E/flutter ( 4156): Tried calling: token
    E/flutter ( 4156): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
    E/flutter ( 4156): #1 KeycloakAuth.getAuthHeaders
    E/flutter ( 4156): #2 KeycloakAuth.getKeycloakUsers
    E/flutter ( 4156): #3 _CheckInFormState.build.<anonymous closure>
    E/flutter ( 4156): #4 _InkResponseState._handleTap
    E/flutter ( 4156): #5 _InkResponseState.build.<anonymous closure>
    E/flutter ( 4156): #6 GestureRecognizer.invokeCallback

    Rakshith G
    hello simple_auth, I have a backend oAuth code written on node.js. I have to integrate it to flutter. Can anyone guide me on the process to follow, here is the link to the Node.JS code: https://github.com/Rakshak1344/OAuth
    I have a Google and Facebook Passport Strategy on Node.JS which accepts authorization code. Further, the code is exchanged for the access token
    Naveen yadav
    How can i integrate facebook and instagram auth via this plugin i didn't understand the example.
    i m new to flutter and I m trying to make reddit authentication using Draw. I am unable to find how to get 'Code' query parameter from redirect url. I also tried Web authentication Flow tht is in test/auth/web_auth.dart .
    https://github.com/draw-dev/DRAW for installed app authentication
    Luis Felipe Dominguez Vega
    im using simple auth with keycloak, but when the WebView need to come back then a PlatformException ocurred
    something with the saving of secured data
    Long Nguyen
    hey everybody
    I have a problem need to resolve.
    on mobile, My browser do not redirect to app after login success.
    it show notify Open my app but not working
    Hello, return _igApi.authenticate().then(
    return catch
    Invalid argument(s)
    how to resolve?
    i want to integrate my flutter app with keycloak installed on local machine. (Client id, Client secrete , baseUrl,realm) this parameters are getting from keycloak instance created on locally. what should i give "identifier" and "redirecturl" ? i have chose the redirecturl=from identifier(githhub,google) panel since i am trying to connect keyclock with (githhub,google). it is giving me errors like this when i am calling
    " var profile=keyclockApi.getUserProfile(); "
    Luca Panteghini

    I'm trying to implement Keycloack auth in a Flutter Web application but I don't understand the correct way to do that, here my code:

      import 'package:simple_auth/simple_auth.dart' as simpleAuth;
      import 'package:simple_auth_flutter/simple_auth_flutter.dart';
      void initState() {
      authenticate() async {
        String identifier = 'keycloak';
        String clientId = 'myclientid';
        String clientSecret = "realm-public-key";
        String redirectUrl = 'http://localhost:3000/';
        String baseUrl = 'https://test-myurl.com/auth/';
        String realm = 'myrealm';
        simpleAuth.KeycloakApi keycloakApi = simpleAuth.KeycloakApi(
            scopes: ['openid', 'profile']
        var response = await keycloakApi.authenticate();

    I receive this error on startup, when he try to initialize and the same error when I launch the authenticate function:

    ======== Exception caught by services library============
    The following MissingPluginException was thrown while activating platform stream on channel simple_auth_flutter/urlChanged:
    MissingPluginException(No implementation found for method listen on channel simple_auth_flutter/urlChanged)

    Someone has an example to follow?


    hi everyone,
    i was trying to make a small auth app for github..

    my query is what is the reddict url?

    the app works fine,
    its logs in but stops as there is no reddict..
    can any one tell what is this reddict url?

    Hello, does simple auth support Flutter web?