Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix android phone authentication #308

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

Open
CharlesEtieve wants to merge 3 commits into GitLiveApp:master
base: master
Choose a base branch
Loading
from CharlesEtieve:fix_android_phone_authentification

Conversation

@CharlesEtieve
Copy link

@CharlesEtieve CharlesEtieve commented May 20, 2022

Current behavior blocks sms code user input until auto retrieval timeout is reached.

Documentation states it is not recommended to enable user input after sms code retrieval timeout, we should rather enable user input after code sent.
https://firebase.google.com/docs/auth/android/phone-auth#oncodeautoretrievaltimeoutstring-verificationid

So I moved the getVerificationCode() from onCodeAutoRetrievalTimeOut() to onCodeSent() and it works well on my project.

Copy link
Member

@nbransby nbransby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! And sorry for the delay in reviewing.

What about JS and iOS, do they suffer the same issue?

}

override fun onCodeAutoRetrievalTimeOut(verificationId: String) {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to fail the CompletableDeferred here too otherwise it will hang?

Copy link
Author

@CharlesEtieve CharlesEtieve Aug 7, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we should make a response.complete() in onCodeAutoRetrievalTimeOut(), because the response can be completed only once and we would not be able to make response.complete() after user input when onCodeAutoRetrievalTimeOut() is called before.
Maybe we could add a function inside PhoneVerificationProvider: onCodeAutoRetrievalTimeOut()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't want to complete, you fail it with the appropriate exception

}

override fun onVerificationCompleted(credential: com.google.firebase.auth.PhoneAuthCredential) {
response.complete(Result.success(AuthCredential(credential)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know this isnt your code but we shoudlnt be wrapping the result in a Result - can just fail the CompletableDeferred with completeExceptionally

Copy link
Author

@CharlesEtieve CharlesEtieve Aug 7, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So instead of response.complete(Result.failure(exception)) we should do response.completeExceptionally(exception)?

nbransby reacted with thumbs up emoji
Copy link
Author

CharlesEtieve commented Aug 7, 2022
edited
Loading

Thanks for the PR! And sorry for the delay in reviewing.

What about JS and iOS, do they suffer the same issue?

Hello, sorry for the late reply!
I cannot tell you about the other platforms but I guess not.
My iOS coworker did not implement authentication with this SDK.
It was a little bit too complex with the suspend function inside PhoneVerificationProvider.
I will tell you later about that.
We do not have a JS app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@nbransby nbransby nbransby requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /