MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
270 stars 243 forks source link

application closing when authentication tab ends #280

Closed pankokmu1 closed 2 years ago

pankokmu1 commented 2 years ago

It opens the authentication tab, returns to the application and when it goes to get the token it gives an error due to a comparison that it tries to do with a null value

final authorize = await appAuth.authorize(
        AuthorizationRequest(
          sso.clientId,
          'com.example.app://oauth2',
          issuer: sso.issuer,
          scopes: sso.scopes,
          promptValues: sso.prompt,
          loginHint: sso.loginHint,
          allowInsecureConnections: true,
          additionalParameters: sso.parameters,
        ),
      );

final result = await appAuth.token(
        TokenRequest(
          sso.clientId,
          'com.example.app://oauth2',
          allowInsecureConnections: true,
          authorizationCode: authorize.authorizationCode,
          issuer: sso.issuer,
          codeVerifier: authorize.codeVerifier,
        ),
      );
E/AndroidRuntime( 3652): FATAL EXCEPTION: main
E/AndroidRuntime( 3652): Process: com.example.app, PID: 3652
E/AndroidRuntime( 3652): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 3652):    at net.openid.appauth.IdToken.validate(IdToken.java:155)
E/AndroidRuntime( 3652):    at net.openid.appauth.AuthorizationService$TokenRequestTask.onPostExecute(AuthorizationService.java:694)
E/AndroidRuntime( 3652):    at net.openid.appauth.AuthorizationService$TokenRequestTask.onPostExecute(AuthorizationService.java:563)
E/AndroidRuntime( 3652):    at android.os.AsyncTask.finish(AsyncTask.java:771)
E/AndroidRuntime( 3652):    at android.os.AsyncTask.access$900(AsyncTask.java:199)
E/AndroidRuntime( 3652):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
E/AndroidRuntime( 3652):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 3652):    at android.os.Looper.loop(Looper.java:236)
E/AndroidRuntime( 3652):    at android.app.ActivityThread.main(ActivityThread.java:8056)
E/AndroidRuntime( 3652):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3652):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
E/AndroidRuntime( 3652):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
D/TransportRuntime.SQLiteEventStore( 3652): Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
D/TransportRuntime.JobInfoScheduler( 3652): Scheduling upload for context TransportContext(cct, HIGHEST,***) with jobId=1791701236 in 1000ms(Backend next call timestamp 1640695338377). Attempt 1
I/Process ( 3652): Sending signal. PID: 3652 SIG: 9
Lost connection to device.
bryanCancelWT commented 2 years ago

@pankokmu1 do you know what the login hint here is? is it the actual email of the user, or the actual user name?

or is it perhaps the the input TYPE from html? or perhaps the input AUTOCOMPLETE value from html?

phcs971 commented 2 years ago

How did you fix this?