Skip to content

Commit 731817f

Browse files
committed
Add USER_AUTH password to the sign in docs
1 parent 5cad412 commit 731817f

File tree

1 file changed

+77
-9
lines changed
  • src/pages/[platform]/build-a-backend/auth/connect-your-frontend/sign-in

1 file changed

+77
-9
lines changed

src/pages/[platform]/build-a-backend/auth/connect-your-frontend/sign-in/index.mdx

Lines changed: 77 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ func socialSignInWithWebUI() -> AnyCancellable {
11161116

11171117
## Sign in with passwordless methods
11181118

1119-
Your application's users can also sign in using passwordless methods. To learn more, visit the [concepts page for passwordless](/[platform]/build-a-backend/auth/concepts/passwordless/)
1119+
Your application's users can also sign in using passwordless methods. To learn more, visit the [concepts page for passwordless](/[platform]/build-a-backend/auth/concepts/passwordless/).
11201120

11211121
### SMS OTP
11221122

@@ -1163,7 +1163,7 @@ Amplify.Auth.confirmSignIn(
11631163
Amplify.Auth.confirmSignIn(
11641164
"123456",
11651165
result -> {
1166-
// result.nextStep.signInStep should be "DONE" now
1166+
// result.getNextStep().getSignInStep() should be "DONE" now
11671167
},
11681168
error -> Log.e("AuthQuickstart", error.toString())
11691169
);
@@ -1233,7 +1233,7 @@ RxAmplify.Auth.confirmSignIn(AuthFactorType.SMS_OTP.name())
12331233
RxAmplify.Auth.confirmSignIn("123456")
12341234
.subscribe(
12351235
result -> {
1236-
// result.nextStep.signInStep should be "DONE" now
1236+
// result.getNextStep().getSignInStep() should be "DONE" now
12371237
},
12381238
error -> Log.e("AuthQuickstart", error.toString())
12391239
);
@@ -1367,7 +1367,7 @@ Amplify.Auth.confirmSignIn(
13671367
Amplify.Auth.confirmSignIn(
13681368
"123456",
13691369
result -> {
1370-
// result.nextStep.signInStep should be "DONE" now
1370+
// result.getNextStep().getSignInStep() should be "DONE" now
13711371
},
13721372
error -> Log.e("AuthQuickstart", error.toString())
13731373
);
@@ -1437,7 +1437,7 @@ RxAmplify.Auth.confirmSignIn(AuthFactorType.EMAIL_OTP.name())
14371437
RxAmplify.Auth.confirmSignIn("123456")
14381438
.subscribe(
14391439
result -> {
1440-
// result.nextStep.signInStep should be "DONE" now
1440+
// result.getNextStep().getSignInStep() should be "DONE" now
14411441
},
14421442
error -> Log.e("AuthQuickstart", error.toString())
14431443
);
@@ -1589,32 +1589,100 @@ handleNextSignInStep(nextNextStep);
15891589
</InlineFilter>
15901590

15911591
<InlineFilter filters={["android"]}>
1592+
15921593
<BlockSwitcher>
15931594
<Block name="Java">
15941595

15951596
```java
1596-
// Java code
1597+
// First confirm the challenge type
1598+
Amplify.Auth.confirmSignIn(
1599+
AuthFactorType.PASSWORD, // or PASSWORD_SRP
1600+
result -> {
1601+
if (result.getNextStep().getSignInStep() == AuthSignInStep.CONFIRM_SIGN_IN_WITH_PASSWORD) {
1602+
// Show UI to collect password
1603+
}
1604+
},
1605+
error -> Log.e("AuthQuickstart", error.toString())
1606+
);
1607+
1608+
// Then pass that password into the confirmSignIn API
1609+
Amplify.Auth.confirmSignIn(
1610+
"password",
1611+
result -> {
1612+
// result.getNextStep().getSignInStep() should be "DONE" now
1613+
},
1614+
error -> Log.e("AuthQuickstart", error.toString())
1615+
);
15971616
```
15981617

15991618
</Block>
16001619
<Block name="Kotlin - Callbacks">
16011620

16021621
```kotlin
1603-
// Kotlin code
1622+
// First confirm the challenge type
1623+
Amplify.Auth.confirmSignIn(
1624+
AuthFactorType.PASSWORD.name, // or PASSWORD_SRP
1625+
{ result ->
1626+
if (result.nextStep.signInStep == AuthSignInStep.CONFIRM_SIGN_IN_WITH_PASSWORD) {
1627+
// Show UI to collect password
1628+
}
1629+
},
1630+
{ error ->
1631+
Log.i("AuthQuickstart", "Failed to sign in", error)
1632+
}
1633+
)
1634+
1635+
// Then pass that password into the confirmSignIn API
1636+
Amplify.Auth.confirmSignIn(
1637+
"password",
1638+
{ result ->
1639+
// result.nextStep.signInStep should be "DONE" now
1640+
},
1641+
{ error ->
1642+
Log.i("AuthQuickstart", "Failed to sign in", error)
1643+
}
1644+
)
16041645
```
16051646

16061647
</Block>
16071648
<Block name="Kotlin - Coroutines">
16081649

16091650
```kotlin
1610-
// Kotlin coroutines code
1651+
// First confirm the challenge type
1652+
var result = Amplify.Auth.confirmSignIn(AuthFactorType.PASSWORD.name) // or PASSWORD_SRP
1653+
if (result.nextStep.signInStep == AuthSignInStep.CONFIRM_SIGN_IN_WITH_PASSWORD) {
1654+
// Show UI to collect password
1655+
}
1656+
1657+
// Then pass that password into the confirmSignIn API
1658+
result = Amplify.Auth.confirmSignIn("password")
1659+
1660+
// result.nextStep.signInStep should be "DONE" now
16111661
```
16121662

16131663
</Block>
16141664
<Block name="RxJava">
16151665

16161666
```java
1617-
// RxJava code
1667+
// First confirm the challenge type
1668+
RxAmplify.Auth.confirmSignIn(AuthFactorType.PASSWORD.name()) // or PASSWORD_SRP
1669+
.subscribe(
1670+
result -> {
1671+
if (result.getNextStep().getSignInStep() == AuthSignInStep.CONFIRM_SIGN_IN_WITH_PASSWORD) {
1672+
// Show UI to collect password
1673+
}
1674+
},
1675+
error -> Log.e("AuthQuickstart", error.toString())
1676+
);
1677+
1678+
// Then pass that password into the confirmSignIn API
1679+
RxAmplify.Auth.confirmSignIn("password")
1680+
.subscribe(
1681+
result -> {
1682+
// result.getNextStep().getSignInStep() should be "DONE" now
1683+
},
1684+
error -> Log.e("AuthQuickstart", error.toString())
1685+
);
16181686
```
16191687

16201688
</Block>

0 commit comments

Comments
 (0)