-
Notifications
You must be signed in to change notification settings - Fork 453
Crash on Android : dataIntent must not be null #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm also experiencing this issue. Can I ask what kind of authorization server you're trying to integrate with? I'm having exactly this issue while trying to integrate with Azure Active Directory B2C. |
@finalgriever I don't think it has anything to do with the server. It is purely an issue with the module. Right now I am using browser for Android as it is still crashing. |
I've continued my work on diagnosing this issue, and I've started to realise that this exact error message can occur on any number of problems. In my case, I've been able to reproduce this error message by creating the following invalid states:
Basically, this error message seems to be provoked by any failure in any part of the communication between the auth server, and the client. Which makes troubleshooting any problem in that area a bit of a nightmare. I've since managed to resolve my issues, and now I'm getting "Failed exchange token". Good times :P |
I appreciate it's a nightmare to debug. More informative error messaging is certainly on the roadmap. Are you using a mainstream auth provider or is it in house? Is there any way I could reproduce the error? |
Hi @finalgriever did you find a solution? I'm getting the same "Failed exchance token" error message when trying to integrate with with B2C. |
@kadikraman it is an in-house server. I don't know a way to recreate it. If you guide me through some steps to troubleshoot, I am happy to help |
Sorry @jeff-halhead, I can't remember exactly what I did to resolve that issue.
|
@finalgriever Thanks for getting back to me. I also had a few problems with my configuration and now it is working. I was able to solve them by debugging RNAppAuthModule and looking at the exceptions that were happening. For anyone else who is struggling, this is the config I used that is working for me. It is different from the Azure AD one in the main README file.
|
Interesting @jeff-halhead so the differences I see are
Adding the client id to scopes seems very strange, is that definitely needed? As for editing the url parameter, you can replace that with
Which is equivalent. |
@kadikraman adding the client id to scopes was actually not required. Please disregard that change. I tried adding the sign in policy to additionalParameters but it does not work in my case. |
@kadikraman As I mentioned in closed ticket #101 we are experiencing this same crash when authing against Uber. If you have any tips to nudge us in the right direction, we have some Java resources over here that can help do a deeper diagnosis. Here is the stacktrace from the most recent crash:
|
@duro I'm confident it's not the same issue as the one you've linked to. The problem there was that the Have you managed to reproduce it locally on an emulator or has it just been in logs? |
@kadikraman This has only been in Crashlytics / Play Store logs. We have tried repeatedly to reproduce locally, but to no avail. However, the crash volume in Crashlytics / Play Store is considerable. We have been getting 10-20 a day. |
@duro this is going to be a blast to debug 😄 You've probably already figured this out, but the error is happening here which is when the user has authenticated in the browser, and we're deep linking back to the app. The I don't really know what's causing this, it could be
It would be ideal if we could reproduce the error locally. Do you have any more stats on your logs? Exactly which devices on which version of Android? |
@kadikraman Here is the info that Crashlytics gives us on this: |
@kadikraman And here is what Play Store is reporting: |
I am having this problem also... it was working OK, I would like to believe I didn't change anything, but suddenly it stopped working. My flow is like this: from the app I connect to the OAuth issuer, this redirects me to a server, and the server redirects me back to my app. If I enter directly into the endpoint of my server (without going through the OAuth process), the deeplink works OK. But if I follow the previously mentioned steps, it crashes. Edit: apparently, I had changed something. Removing Edit 2: no launch mode except standard works in my case, all the other ones give the |
We're also seeing this issue occur in Fabric/Crashlytics with some users (we're using Keycloak). However, we've been unable to replicate it locally. @duro Did you find the root cause of the issue in your instance? |
I'm seeing very similar crash stacks to this one, and was able to reproduce this using reproductions steps on the AppAuth Github here: openid/AppAuth-Android#318 My stack is a little different, but probably related:
|
I may have stumbled upon a possible cause/solution to this issue. In my case, I had added DeepLinking support to my app via an This was my bad config:
In
So I was presented with an option after logging in to open the redirect in either "filter_react_native" or "My App". If I chose "filter_react_native", then the app crashed with the DataIntent is null error. And of course the selection sticks, so I would ALWAYS crash after that. But the documentation for AppAuth-android helped me figure out that the The solution is easy, for DeepLinking other content (not auth), just use a different uri. Now my auth uri is different than my (One caveat... my app is not released yet so I am only confirming this with my own personal user experience) |
Seeing this issue from a handful (3-4%) of our Android users as well. Steps to recreate the crash were:
Everything works fine in all other cases (i.e resuming the app from background works fine). Update: looks like having android:launchMode="singleTask" in AndroidManifest.xml causes this behaviour. Removing it is not a solution for our app though as it alters quite a few things. I.e. using android:launchMode="singleTop" and following the steps i've mentioned ends up in having two activities within the app. |
@kadikraman sounds like a reproducible case is found for this, but does this perhaps belong in https://github.com/openid/AppAuth-Android? |
Hi, I have the similar exception but in different case:
(PS. Should I create separate issue?) |
Hi guys! I've played around with react-native-app-auth code and looks like there is an easy solution to this problem. So again, this is the scenario:
So the app crashes after the step 4, and this is the place in the plugin code where it happens (in RNAppAuthModule.java):
So this what happens - onActivityResult is called after step 4 and in that case data (intent) is null. A method from Simplest solution would be to add an if statement just before this method is called which would check if data intent is null and then reject the promise and return if it is. Something like:
Are there any side effects which this approach could case? As far as I see it would only handle the case where dataIntent is null, which is basically an error scenario - that appauth method "AuthorizationResponse.fromIntent" will otherwise always crash the app if it receives null, so it should be ok, there is no point for the onActivityResult to continue. @kadikraman @janpieterz Should I create a pull request? |
For anyone having the same issue, I resolved mine by removing the intent-filter activity from my AndroidManifest.xml (only keep the redirection scheme settings in gradle config). |
Thanks for the great component. It is working perfectly on iOS. But on Android, I am getting a crash.
I have given details below. Please let me know if you need additional details. Thanks!
Device Info
Samsung Galaxy S5
OS: 6.0.1
Package Info
"react-native-app-auth": "^2.6.0",
Issue
Log
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {com.realsavvyv3/com.realsavvyv3.MainActivity-Main}: java.lang.NullPointerException: dataIntent must not be null
at android.app.ActivityThread.deliverResults(ActivityThread.java:4920)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4963)
at android.app.ActivityThread.access$1600(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1848)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: dataIntent must not be null
at net.openid.appauth.Preconditions.checkNotNull(Preconditions.java:55)
at net.openid.appauth.AuthorizationResponse.fromIntent(AuthorizationResponse.java:565)
at com.reactlibrary.RNAppAuthModule.onActivityResult(RNAppAuthModule.java:213)
at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:255)
at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:730)
at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:126)
at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
at android.app.Activity.dispatchActivityResult(Activity.java:7137)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4916)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4963)
at android.app.ActivityThread.access$1600(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1848)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
The text was updated successfully, but these errors were encountered: