File tree Expand file tree Collapse file tree 5 files changed +65
-0
lines changed
firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth Expand file tree Collapse file tree 5 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 44import androidx .annotation .Nullable ;
55
66import com .anotherdev .firebase .auth .provider .IdpAuthCredential ;
7+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailRequest ;
8+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailResponse ;
79import com .google .firebase .FirebaseApp ;
810
911import io .reactivex .rxjava3 .annotations .CheckReturnValue ;
@@ -53,5 +55,9 @@ public interface FirebaseAuth {
5355 @ CheckReturnValue
5456 Single <SignInResponse > linkWithCredential (@ NonNull FirebaseUser user , @ NonNull IdpAuthCredential credential );
5557
58+ @ NonNull
59+ @ CheckReturnValue
60+ Single <SendPasswordResetEmailResponse > sendPasswordResetEmail (SendPasswordResetEmailRequest request );
61+
5662 void signOut ();
5763}
Original file line number Diff line number Diff line change 1414import com .anotherdev .firebase .auth .rest .api .RestAuthApi ;
1515import com .anotherdev .firebase .auth .rest .api .model .ExchangeTokenRequest ;
1616import com .anotherdev .firebase .auth .rest .api .model .ImmutableSignInWithIdpRequest ;
17+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailRequest ;
18+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailResponse ;
1719import com .anotherdev .firebase .auth .rest .api .model .SignInAnonymouslyRequest ;
1820import com .anotherdev .firebase .auth .rest .api .model .SignInWithCustomTokenRequest ;
1921import com .anotherdev .firebase .auth .rest .api .model .SignInWithEmailPasswordRequest ;
@@ -155,6 +157,12 @@ private Single<SignInResponse> performSignInWithCredential(ImmutableSignInWithId
155157 .map (this ::saveCurrentUser );
156158 }
157159
160+ @ NonNull
161+ @ Override
162+ public Single <SendPasswordResetEmailResponse > sendPasswordResetEmail (SendPasswordResetEmailRequest request ) {
163+ return RestAuthApi .auth ().sendPasswordResetEmail (request );
164+ }
165+
158166 @ Override
159167 public void signOut () {
160168 userStore .delete ();
Original file line number Diff line number Diff line change 44import com .anotherdev .firebase .auth .UserProfileChangeRequest ;
55import com .anotherdev .firebase .auth .UserProfileChangeResponse ;
66import com .anotherdev .firebase .auth .rest .api .model .IdTokenRequest ;
7+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailRequest ;
8+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailResponse ;
79import com .anotherdev .firebase .auth .rest .api .model .SignInRequest ;
810import com .anotherdev .firebase .auth .rest .api .model .SignInWithCustomTokenRequest ;
911import com .anotherdev .firebase .auth .rest .api .model .SignInWithEmailPasswordRequest ;
@@ -36,6 +38,9 @@ public interface IdentityToolkitApi {
3638 @ POST ("v1/accounts:signInWithCustomToken" )
3739 Single <SignInResponse > signInWithCustomToken (@ Body SignInWithCustomTokenRequest request );
3840
41+ @ POST ("v1/accounts:sendOobCode" )
42+ Single <SendPasswordResetEmailResponse > sendPasswordResetEmail (@ Body SendPasswordResetEmailRequest request );
43+
3944 @ POST ("v1/accounts:lookup" )
4045 Single <JsonObject > getAccounts (@ Body IdTokenRequest request );
4146
Original file line number Diff line number Diff line change 1+ package com .anotherdev .firebase .auth .rest .api .model ;
2+
3+ import com .google .gson .annotations .SerializedName ;
4+
5+ import org .immutables .gson .Gson ;
6+ import org .immutables .value .Value ;
7+
8+ @ Value .Immutable
9+ @ Value .Style (strictBuilder = true )
10+ @ Gson .TypeAdapters
11+ public interface SendPasswordResetEmailRequest {
12+
13+ @ SerializedName ("email" )
14+ String getEmail ();
15+
16+ @ Value .Default
17+ @ SerializedName ("requestType" )
18+ default String getRequestType () {
19+ return "PASSWORD_RESET" ;
20+ }
21+
22+
23+ static ImmutableSendPasswordResetEmailRequest .Builder builder () {
24+ return ImmutableSendPasswordResetEmailRequest .builder ();
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ package com .anotherdev .firebase .auth .rest .api .model ;
2+
3+ import com .google .gson .annotations .SerializedName ;
4+
5+ import org .immutables .gson .Gson ;
6+ import org .immutables .value .Value ;
7+
8+ @ Value .Immutable
9+ @ Value .Style (strictBuilder = true )
10+ @ Gson .TypeAdapters
11+ public interface SendPasswordResetEmailResponse {
12+
13+ @ SerializedName ("email" )
14+ String getEmail ();
15+
16+
17+ static ImmutableSendPasswordResetEmailResponse .Builder builder () {
18+ return ImmutableSendPasswordResetEmailResponse .builder ();
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments