Closed davidvavra closed 2 years ago
Thanks for the PR. Could you sign our CLA? https://developer.okta.com/cla/
We will also want to add a test for this. Could you do that?
I have already signed SLA with my first pull request. Is it required to sign it for every PR?
I added the test for this.
Sorry, we don't have an easy way to check for CLAs, one signature is enough. Thanks.
I'm also not in love with this fix. We don't have any way to notify the caller that their logout failed, and didn't do what they expected.
I think this could be detected in application logic by checking if the activity is finished before calling into the Okta SDK.
This is how we call Okta SDK for logout:
1) client.registerCallback(...)
2) client.signOutOfOkta(activity)
3) When the callback is triggered (same handling for all cases):
4) client.sessionClient?.clear()
5) activity.finish()
So I don't see a way how we could check if activity is finished before calling Okta SDK. I think this check needs to be inside Okta SDK. Do you have some suggestions how to do it better? I don't have a big knowledge of internals of the SDK and didn't want to change it too much.
For step 2, could you wrap that in an if (!activity.isFinished()) {
call?
You might be right, we never finish the activity before we get callback from the SDK. But the user could do that. I will add that if and let you know in the issue if that stopped the crashes. I will close this PR for now.
Thank you! And thanks again for putting the time in to post a PR. Really appreciate it.
Did this fixed the crash for Fragment manager has been destroyed
for Okta ?
Hi @ashish-d-hh please see #263 as we're still working through it in that issue.
Reopening based on discussion in the issue. @JayNewstrom Could you help with the unit test? I don't have that much knowledge about your test setup.
@davidvavra Sure. If you want to remove the test portion of the PR, I can merge that, and follow up with a test in another PR.
Thanks, reverted.
We see crashes in logout in our production app. Here is the stacktrace:
The app crashes, because
FragmentManager
is destroyed, but the SDK is trying to commit aFragment
transaction.I'm not sure about the root cause, but the fix is a simple check if
FragmentManager
is destroyed. It should not crash in this case and normal functionality should not be affected.Closes this issue: https://github.com/okta/okta-oidc-android/issues/263