Skip to content

AuthenticationCallback methods are only called the first time I login #607

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

Closed
DaireJN opened this issue Feb 15, 2021 · 3 comments · Fixed by #619
Closed

AuthenticationCallback methods are only called the first time I login #607

DaireJN opened this issue Feb 15, 2021 · 3 comments · Fixed by #619
Labels
bug This points to a verified bug in the code waiting for customer This issue is waiting for a response from the issue or PR author
Milestone

Comments

@DaireJN
Copy link

DaireJN commented Feb 15, 2021

Describe the problem

the first time i login callbacks are recieved as expected callbacks are not recieved in subsequent logins, if i close the app and attempt to login again the same occurs (first time = callbacks recieved, nothing subsequent times) The logs in the auth0 dashboard indicate everything is ok

What was the expected behavior?

callback recieved everytime i login or cancel/error

Sample

Here is a project demontrating the issue, to build it replace "com_auth0_domain" and "com_auth0_client_id" in strings.xml with valid credentials and run.

https://github.com/DaireJN/LockExample.git

Logs

these logs are recieved on fist sign in, no logs occur for subsequent sign ins until app is killed + reopened

2021-02-15 17:42:14.646 26962-26962/packagename V/Lock: AUTHENTICATION action received in our BroadcastReceiver
2021-02-15 17:42:14.646 26962-26962/packagename D/AuthenticationCallback: User authenticated!

lockui2.mov

Environment

  • Version of this library used: 2.24.0
  • Which framework are you using, if applicable:
  • Other modules/plugins/libraries that might be involved: Kotlin
  • Any other relevant information you think would be useful: min sdk 21 target sdk 29
@DaireJN
Copy link
Author

DaireJN commented Feb 22, 2021

Any insights on this?

@lbalmaceda
Copy link
Contributor

@DaireJN Sorry for the delayed response. Thanks for providing a repro project, I was able to reproduce this.

It seems this offending line in the library code is unregistering the even listener after an event was received. As long as devs are calling lock.onDestroy() to clear that broadcast listener registration when they decide, we should be able to remove that line safely.

So TLDR, we have to:

  • Remove the line I linked above in both PasswordlessLock and Lock files.
  • Improve the docs around calling onDestroy to ensure a proper lifecycle callback handling.

In the meantime, and since the listener is registered every time you build a lock instance from the Builder, you can use that to reset the callback registration.

@lbalmaceda lbalmaceda added the bug This points to a verified bug in the code label Mar 29, 2021
@lbalmaceda
Copy link
Contributor

@DaireJN I realize the readme today is not clear enough about the lock instance disposal in the Activity#onDestroy method. Considering that this library has been out for more than 4 years like this and this is the first time someone reports this bug, I'll make the fix available only for the next major to prevent introducing a different behavior for major v2 customers.

We're working on the next major and I opened a PR to fix this there (linked above). I'd appreciate your feedback on whether the new guidance is more clear or not. See migration guide and readme changes.

@lbalmaceda lbalmaceda added the waiting for customer This issue is waiting for a response from the issue or PR author label Apr 28, 2021
@lbalmaceda lbalmaceda added this to the Major - v3 milestone Apr 28, 2021
@lbalmaceda lbalmaceda linked a pull request Apr 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code waiting for customer This issue is waiting for a response from the issue or PR author
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants