MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
275 stars 246 forks source link

App not working in Android 9 and above #91

Closed avsys-anand closed 4 years ago

avsys-anand commented 4 years ago

Hello,

I am developing an app in flutter and it works on version 8 and below. but 9+ versions cannot run app beyond keycloak login.

Here is my error

Error report: >> PlatformException(authorize_and_exchange_code_failed, Failed to authorize: [error: null, description: User cancelled flow], null) <<

Error:

PlatformException(authorize_and_exchange_code_failed, Failed to authorize: [error: null, description: User cancelled flow], null)

Stack trace:

#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33)

#2 FlutterAppAuth.authorizeAndExchangeCode (package:flutter_appauth/src/flutter_appauth.dart:24:57)

#3 oidcLogin (package:taskManagementApp/services/oidc-connector.dart:24:46)

#4 _SplashScreenState.tryAccessToken (package:taskManagementApp/pages/splashScreen.dart:174:11)

#5 _SplashScreenState.navigationPage (package:taskManagementApp/pages/splashScreen.dart:97:22)

#6 _rootRun (dart:async/zone.dart:1120:38)
#7 _CustomZone.run (dart:async/zone.dart:1021:19)
#8 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#9 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)
#10 _rootRun (dart:async/zone.dart:1124:13)
#11 _CustomZone.run (dart:async/zone.dart:1021:19)
#12 _CustomZone.bindCallback. (dart:async/zone.dart:947:23)
#13 Timer._createTimer. (dart:async-patch/timer_patch.dart:21:15)
#14 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#15 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#16 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

Device parameters:

id: QP1A.190711.020
androidId: 702e0799f197c4e0
board: exynos7904
bootloader: M205FDDU3CSL5
brand: samsung
device: m20lte
display: QP1A.190711.020.M205FDDU3CSL5
fingerprint: samsung/m20ltedd/m20lte:10/QP1A.190711.020/M205FDDU3CSL5:user/release-keys
hardware: exynos7904
host: SWDH2815
isPsychicalDevice: true
manufacturer: samsung
model: SM-M205F
product: m20ltedd
tags: release-keys
type: user
versionBaseOs:
versionCodename: REL
versionIncremental: M205FDDU3CSL5
versionPreviewSdk: 0
versionRelase: 10
versionSdk: 29
versionSecurityPatch: 2019-12-01

and my config is

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.17763.1039], locale en-IN) • Flutter version 1.12.13+hotfix.8 at C:\flutter • Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0 [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\avs02\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) • All Android licenses accepted. [√] Android Studio (version 3.5) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin version 43.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

Please help!

MaikuB commented 4 years ago

I've been able to run this on Android 9+ before. Can you clone the repository and run the example app if it works on the Android 9+ devices/emulators you were using to see if it works?

avsys-anand commented 4 years ago

Thanks for the reply! Just one question, do i need to make secure http api calls for this plugin to work ?

MaikuB commented 4 years ago

Can you be more specific about what you mean here? Are you referring to http token and auth endpoints or API calls that you would make after being authorised?

Also what about the response to my question on the previous post I made?

Can you clone the repository and run the example app if it works on the Android 9+ devices/emulators you were using to see if it works?

boylenssen commented 4 years ago

My issue here was that the redirect URL did not end with oauthredirect

MaikuB commented 4 years ago

Closing due to lack of further response from the original poster. Note that I've read keycloak requires extra setup on more recent versions of Android. Another poster has posted their solution in https://github.com/MaikuB/flutter_appauth/issues/92 that you may want to try out. This is specific to keycloak and not to do with this plugin