Summary
Four gaps in this SDK's auth API surface prevent firebase-kotlin-sdk from sharing its
androidMain source with its JVM target for firebase-auth. Closing all four would let
it delete a ~474-line source fork it has carried since 2023.
No working implementations are required — see "Why this is small" below.
Edit: this issue originally listed only the PhoneAuthOptions gap. That alone is
not sufficient to remove the fork — three further gaps in auth.kt were found
afterwards. All four are now listed.
Background
firebase-kotlin-sdk compiles its JVM target by sharing the androidMain source set:
getByName("jvmMain") { kotlin.srcDir("src/androidMain/kotlin") }
10 of its 14 modules do this. firebase-auth used to, but when the Android SDK was
raised, androidMain moved onto APIs this SDK doesn't expose. In f372c418d the
sharing was removed and a parallel src/jvmMain copy was forked.
That fork is 4 files / ~474 lines maintained by hand with no compiler enforcement, and
it has already diverged — multifactor.kt is a byte-identical copy.
The four gaps
1. PhoneAuthOptions does not exist
Android moved phone verification from the instance API to a builder/static API:
PhoneAuthOptions options = PhoneAuthOptions.newBuilder(auth)
.setPhoneNumber(phoneNumber).setTimeout(timeout, unit)
.setActivity(activity).setCallbacks(callbacks).build();
PhoneAuthProvider.verifyPhoneNumber(options);
This SDK exposes only the old getInstance(auth).verifyPhoneNumber(...) shape.
Needed: PhoneAuthOptions with static Builder newBuilder(FirebaseAuth), and
Builder methods setPhoneNumber(String), setTimeout(Long, TimeUnit),
setActivity(Activity), setCallbacks(PhoneAuthProvider.OnVerificationStateChangedCallbacks),
setForceResendingToken(PhoneAuthProvider.ForceResendingToken), build().
Plus PhoneAuthProvider.verifyPhoneNumber(PhoneAuthOptions) as a static overload.
2. AuthResult.getCredential() missing
com.google.firebase.auth.AuthResult here is:
public interface AuthResult {
FirebaseUser getUser();
}
Needed: AuthCredential getCredential().
3. AuthResult.getAdditionalUserInfo() and AdditionalUserInfo missing
Same interface — no getAdditionalUserInfo(). The AdditionalUserInfo type does not
exist in this SDK at all.
Needed: an AdditionalUserInfo type exposing getProviderId(), getUsername(),
getProfile(), isNewUser(), and AuthResult.getAdditionalUserInfo() returning it.
4. ActionCodeSettings.Builder.setLinkDomain(String) missing
The builder here has setDynamicLinkDomain(String) but not the newer
setLinkDomain(String) that Android replaced it with.
Needed: Builder setLinkDomain(String).
Why this is small
The existing PhoneAuthProvider here is already a pure compile-time stub — every method
throws NotImplementedError():
public static PhoneAuthProvider getInstance(FirebaseAuth auth) {
throw new NotImplementedError();
}
So none of this works on JVM today, and this request does not change that. What's needed
is only that the API shape match the current Android surface, with the same
NotImplementedError bodies (or null returns where a type is simply absent). Behaviour
is identical before and after; the gain is purely that downstream androidMain source
compiles unchanged for JVM.
Outcome
With all four closed, firebase-kotlin-sdk can restore
kotlin.srcDir("src/androidMain/kotlin") for firebase-auth, delete src/jvmMain/
(4 files, ~474 lines), and eliminate the android/jvm drift class of bug for that module.
Partial fixes still help but do not remove the fork — gaps 2, 3 and 4 are all in
auth.kt, so PhoneAuthOptions alone leaves that file unshareable.
Related downstream context: GitLiveApp/firebase-kotlin-sdk#799 touches the same files.
Summary
Four gaps in this SDK's auth API surface prevent
firebase-kotlin-sdkfrom sharing itsandroidMainsource with its JVM target forfirebase-auth. Closing all four would letit delete a ~474-line source fork it has carried since 2023.
No working implementations are required — see "Why this is small" below.
Background
firebase-kotlin-sdkcompiles its JVM target by sharing theandroidMainsource set:10 of its 14 modules do this.
firebase-authused to, but when the Android SDK wasraised,
androidMainmoved onto APIs this SDK doesn't expose. Inf372c418dthesharing was removed and a parallel
src/jvmMaincopy was forked.That fork is 4 files / ~474 lines maintained by hand with no compiler enforcement, and
it has already diverged —
multifactor.ktis a byte-identical copy.The four gaps
1.
PhoneAuthOptionsdoes not existAndroid moved phone verification from the instance API to a builder/static API:
This SDK exposes only the old
getInstance(auth).verifyPhoneNumber(...)shape.Needed:
PhoneAuthOptionswithstatic Builder newBuilder(FirebaseAuth), andBuildermethodssetPhoneNumber(String),setTimeout(Long, TimeUnit),setActivity(Activity),setCallbacks(PhoneAuthProvider.OnVerificationStateChangedCallbacks),setForceResendingToken(PhoneAuthProvider.ForceResendingToken),build().Plus
PhoneAuthProvider.verifyPhoneNumber(PhoneAuthOptions)as a static overload.2.
AuthResult.getCredential()missingcom.google.firebase.auth.AuthResulthere is:Needed:
AuthCredential getCredential().3.
AuthResult.getAdditionalUserInfo()andAdditionalUserInfomissingSame interface — no
getAdditionalUserInfo(). TheAdditionalUserInfotype does notexist in this SDK at all.
Needed: an
AdditionalUserInfotype exposinggetProviderId(),getUsername(),getProfile(),isNewUser(), andAuthResult.getAdditionalUserInfo()returning it.4.
ActionCodeSettings.Builder.setLinkDomain(String)missingThe builder here has
setDynamicLinkDomain(String)but not the newersetLinkDomain(String)that Android replaced it with.Needed:
Builder setLinkDomain(String).Why this is small
The existing
PhoneAuthProviderhere is already a pure compile-time stub — every methodthrows
NotImplementedError():So none of this works on JVM today, and this request does not change that. What's needed
is only that the API shape match the current Android surface, with the same
NotImplementedErrorbodies (or null returns where a type is simply absent). Behaviouris identical before and after; the gain is purely that downstream
androidMainsourcecompiles unchanged for JVM.
Outcome
With all four closed,
firebase-kotlin-sdkcan restorekotlin.srcDir("src/androidMain/kotlin")forfirebase-auth, deletesrc/jvmMain/(4 files, ~474 lines), and eliminate the android/jvm drift class of bug for that module.
Partial fixes still help but do not remove the fork — gaps 2, 3 and 4 are all in
auth.kt, soPhoneAuthOptionsalone leaves that file unshareable.Related downstream context: GitLiveApp/firebase-kotlin-sdk#799 touches the same files.