GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Default phone by yramanchuk · Pull Request #906 · firebase/FirebaseUI-Android

Conversation

@yramanchuk

@yramanchuk yramanchuk commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

Implement phone Auth flow Phone number configuration parameter.
Related issue #887

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yramanchuk added 2 commits September 12, 2017 13:24
@yramanchuk
Add default phone number to the Phone Auth number flow.
d82aa47
@yramanchuk
Update comments.
d1da327
@yramanchuk
yramanchuk requested a review from samtstern September 12, 2017 20:31
@SUPERCILEX

SUPERCILEX commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

@yramanchuk I believe the result of that issue was that FirebaseUI isn't going to support this kind of flow. Could you explain why you already have a phone number? The user should be giving that to FirebaseUI in the auth flow, not to you directly. Hope this clears things up! 😄

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ashwinraghav

ashwinraghav commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

@yramanchuk I think the issue that is linked to may not be completely comparable.

@SUPERCILEX The problem we are addressing is rooted in the fact that Firebase UI currently does not support 2FA (Say Facebook + Phone Auth). To work around this, apps that wish to use phone as the second factor can use Facebook login on their own outside Firebase UI and then use Firebase UI for the second factor phone auth.
This change helps apps that "know" the second factor phone number given a Facebook account, particularly when a user is logging into their secondary device like a tablet. Hope that helps.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yramanchuk

yramanchuk commented Sep 12, 2017

Copy link
Copy Markdown
Contributor Author

@ashwinraghav Thanks for the clarification.
@SUPERCILEX here's another example: application may have multi-dialog account creation flow and they have already requested user to enter his phone number, so they would like to show phone verification dialog with pre-filled phone number.

Here's related FirebaseUI-iOS issue: firebase/FirebaseUI-iOS#306
This request is required for the feature parity: firebase/FirebaseUI-iOS#334

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ashwinraghav
ashwinraghav reviewed Sep 12, 2017
View reviewed changes
Comment thread auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java Outdated
break;
case AuthUI.PHONE_VERIFICATION_PROVIDER:
mProviders.add(new PhoneProvider(this, getFlowParams()));
PhoneIdpConfig phoneIdpConfig = (PhoneIdpConfig) idpConfig;

@ashwinraghav ashwinraghav Sep 12, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Would this break older clients, breaking backward compatibility?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java Outdated
}
}

public static class PhoneIdpConfig extends IdpConfig {

@ashwinraghav ashwinraghav Sep 12, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I feel like introducing a config per for phone auth provider leaves me desiring symmetry for such a config in other providers.

Also, the type safety that this implementation gives is hard to enforce in a backward compatible way. This leads to unsafe typecasting like the one made in

FirebaseUI-Android/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java

Line 118 in d1da327

PhoneIdpConfig phoneIdpConfig = (PhoneIdpConfig) idpConfig;

My suggestion would be to introduce a Bundle parameter into the existing IdpConfig that yields an API that would look like:

Bundle b = new Bundle();
b.putString(AuthUI.PHONE_VERIFICATION_PROVIDER.DEFAULT_PHONE_EXTRA, "+16478488383");

new AuthUI.IdpConfig.Builder(AuthUI.PHONE_PROVIDER).setParams(bundle).build()) and wire it into the providers from that point on.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@yramanchuk yramanchuk Sep 12, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@ashwinraghav Thhank's for the suggestion. I was thinking about extending existing IdpConfig but in that case were are adding changes to all configs (Google, Facebook) and they they don't need that parameter.

Anyway I think your solution is more elegant. I just want to propose to use List of Bundles instead of just Bundle:

AuthUI.IdpConfig.Builder(AuthUI.PHONE_PROVIDER).setParams(List).build())

In that case we can pass multiple params.
@ashwinraghav what do you think?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samtstern
samtstern changed the base branch from master to version-2.3.1-dev September 12, 2017 23:52
@samtstern

samtstern commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

@yramanchuk FYI I changed the target branch to the current development branch, version-2.3.1-dev.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@samtstern

samtstern commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

Note that the issue of IDP-specific configuration has been discussed here as well:
#806

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Jacob Stimes
Using Bundle for phone instead of new IdpConfig
5f2bf6e
samtstern
samtstern reviewed Sep 13, 2017
View reviewed changes

@samtstern samtstern left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Mostly good, a few remaining comments,

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java Outdated
// Use the params Bundle to provide a default phone number that will populate the
// phone number field in PhoneVerificationActivity if the number is known in advance.
Bundle params = new Bundle();
params.putString(AuthUI.PHONE_VERIFICATION_DEFAULT_PHONE_EXTRA, "+13099126574");

@samtstern samtstern Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is a minor point, but I think putting a random phone number into the sample will cause confusion. Many people will want to use this sample to test phone auth with their real number.

This type of example snippet belongs in the README.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Moved to README, let me know if you don't think it's in an appropriate location.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java
.getString(AuthUI.PHONE_VERIFICATION_DEFAULT_PHONE_EXTRA);
startActivityForResult(
PhoneVerificationActivity.createIntent(getContext(), flowParams, null),
PhoneVerificationActivity.createIntent(getContext(), flowParams, phone),

@samtstern samtstern Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This createIntent call uses ExtraConstants.EXTRA_PHONE. We should unify the values between this and AuthUI.PHONE_VERIFICATION_DEFAULT_PHONE_EXTRA.

I'd suggest:

class AuthUI {
  // ...
  public static final String EXTRA_DEFAULT_PHONE = ExtraConstants.EXTRA_PHONE;
  // ...
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

That's reasonable, made your suggested change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java Outdated
break;
case AuthUI.PHONE_VERIFICATION_PROVIDER:
mProviders.add(new PhoneProvider(this, getFlowParams()));
PhoneIdpConfig phoneIdpConfig = (PhoneIdpConfig) idpConfig;

@samtstern samtstern Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This class PhoneIdpConfig is used here but I don't see it defined in this PR anymore. I think changes to this file need to be revisited.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oops, gone now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samtstern

samtstern commented Sep 13, 2017

Copy link
Copy Markdown
Contributor

@SUPERCILEX the main reason for supporting this flow is feature parity with what Digits used to offer. We are telling all Digits developers to move to FirebaseUI and some of them noticed this missing feature.

You are right though, it was not a flow we originally intended to support. Ashwin and Yury have provided some examples where it can be very useful though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Jacob Stimes
Resolved PR comments - renamed key, removed old code, moved sample to…
528fd74
… README
SUPERCILEX
SUPERCILEX reviewed Sep 13, 2017
View reviewed changes

@SUPERCILEX SUPERCILEX left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@yramanchuk @ashwinraghav @samtstern Thanks for all your explanations, I see why this is necessary now!

@yramanchuk I just have a few comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java Outdated
selectedProviders.add(
new IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build());
new IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER)
.build());

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Might as well undo the changes in this file since they're leftovers from previous commits.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reverted.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java Outdated
paramsValueBuilder.append(mParams.get(key).toString());
paramsValueBuilder.append(",");
}
paramsValueBuilder.append("}");

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Doesn't Bundle already have a toString() with very similar behavior?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yeah, just check the source and Bundle#toString() calls mMap.toString(). I'm assuming the formatting will be a little bit different, but the output should be effectively the same.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ah, did not realize that. Switched to the Bundle toString.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/PhoneProvider.java Outdated
String phone = null;
for (AuthUI.IdpConfig idpConfig : mFlowParameters.providerInfo) {
if (idpConfig.getProviderId().equals(AuthUI.PHONE_VERIFICATION_PROVIDER)) {
phone = idpConfig.getParams().getString(EXTRA_DEFAULT_PHONE);

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

To be consistent, we shouldn't statically import this and instead use AuthUI.EXTRA_DEFAULT_PHONE.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java Outdated
case PhoneAuthProvider.PROVIDER_ID:
// Go directly to phone flow
String phone = idpConfigs
.get(0)

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This same logic is used above so we should probably extract a firstIdpConfig and replace firstProvider with the method call.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good point, done.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
SUPERCILEX
SUPERCILEX reviewed Sep 13, 2017
View reviewed changes
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java Outdated
private IdpConfig(Parcel in) {
mProviderId = in.readString();
mScopes = Collections.unmodifiableList(in.createStringArrayList());
mParams = in.readBundle();

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This should be in.readBundle(getClass().getClassLoader()) to make the build pass. Since we're just passing in strings right now we don't actually need this, but it'll ensure we're future proof (and make lint happy).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ah, just noticed the CONTRIBUTING.md file. Apologies - just beginning contribution to the library and obviously wasn't paying full attention. Made the change and build should be passing now. Thanks for the review by the way!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Jacob Stimes
Resolving more comments - style consistency and lint conformance
76a6161
SUPERCILEX
SUPERCILEX reviewed Sep 13, 2017
View reviewed changes
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java Outdated
return "IdpConfig{" +
"mProviderId='" + mProviderId + '\'' +
", mScopes=" + mScopes +
", mParams=" + mParams.toString() +

@SUPERCILEX SUPERCILEX Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

One last nit! 😄 We don't need the toString() call, mParams alone is just fine.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jstimes jstimes Sep 13, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Removed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Jacob Stimes
Removed toString call
8efcc56
SUPERCILEX
SUPERCILEX approved these changes Sep 13, 2017
View reviewed changes

@SUPERCILEX SUPERCILEX left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@yramanchuk Sweet, LGTM! 😄

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
samtstern
samtstern approved these changes Sep 13, 2017
View reviewed changes

@samtstern samtstern left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samtstern

samtstern commented Sep 13, 2017

Copy link
Copy Markdown
Contributor

I will merge this once Travis is happy.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@samtstern
samtstern merged commit e4ece3a into version-2.3.1-dev Sep 14, 2017
@samtstern samtstern added this to the 2.3.1 milestone Sep 14, 2017
@samtstern
samtstern deleted the default_phone branch September 29, 2017 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

4 more reviewers
@ashwinraghav ashwinraghav ashwinraghav left review comments
@jstimes jstimes jstimes left review comments
@samtstern samtstern samtstern approved these changes
@SUPERCILEX SUPERCILEX SUPERCILEX approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

2.4.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@yramanchuk @SUPERCILEX @ashwinraghav @samtstern @jstimes
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.