react-native-app-auth: react-native-app-auth module getting crashed in Android

Issue

Firebase crashlytics report below crash issue in react-native app Android. There is no issues in iOS.

Caused by java.lang.NullPointerException Attempt to invoke virtual method ‘boolean java.lang.Boolean.booleanValue()’ on a null object reference

com.rnappauth.RNAppAuthModule.onActivityResult (RNAppAuthModule.java:414)


Environment

  • Your Identity Provider: e.g. IdentityServer 4 / Okta / Azure Unable to identify because this is NPM module level crash

  • Platform that you’re experiencing the issue on: iOS / Android / both Platform: Android

  • Are you using Expo? No

Please provide suggestions to fix this issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Will this issue be fixed soon or is the library not longer maintained?

Is there any update about this issue @Jay-A-McBee ?

This issue occurs on low-end Android devices that kill the Activity when your app is backgrounded during the authentication process. We persist values in private instance fields so we can read/use them during the code/token exchange in our onActivityResult handler. We end up getting a null pointer exception because these values don’t exist when we go to read them. Notice the first line in the posted stack trace

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
    at com.rnappauth.RNAppAuthModule.onActivityResult(RNAppAuthModule.java:419)

I’ve talked with the other maintainers and we are going to try to get around to a fix for this. I can’t provide a timeline, but just a heads up that it’s on our radar. There are a few issues in the repo where this is the root cause.

Hello @Jay-A-McBee It does not just happen in low-end devices it also happens in so many high-end ones. Is there any chance to get the PR merged or solve this issue?

Are there any plans of including this change https://github.com/Nirodha26/react-native-app-auth/pull/1 in an official release to fix this issue?

This might be a different reason for crashing, but I was able to resolve my crash by adding in dangerouslyAllowInsecureHttpRequests: true

I don’t know how to check android’s native log so I am not sure if its the same error. But in my research to resolve my issue, I ended up here and issue #600 a couple times, so I hope this can help anyone suffering from the same error.

@RubenPM-dev Thanks for the PR, we will review it as soon as possible.

Hi everyone, we don’t currently have any resources able to take on this work, but are happy to accept PRs from the community.

Thanks for all your work on this library, there are now a few PRs still open for a while. I have just submitted mine with the solution suggested by @yberstad which I can say it works on our end.

https://github.com/FormidableLabs/react-native-app-auth/issues/564

It would be great if this fix was merged into official and added in a next release.