Skip to content

Commit 9bbb84e

Browse files
helgabalashovaRachel Lee Nabors
authored andcommitted
adds forceAliasCreations clarification to auth docs (#5014)
* adds forceAliasCreations clarification to auth docs
1 parent c955d67 commit 9bbb84e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/fragments/lib/auth/js/emailpassword.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ async function confirmSignUp() {
6868
}
6969
```
7070

71+
As part of the options parameter, you can specify the `forceAliasCreation` boolean. By default
72+
set to `True`. If set to `False` and the email or phone number used for sign up confirmation
73+
already exists as an alias for a different user, the API will throw an `AliasExistsException`
74+
error. If set to `True`, the API call will migrate the alias from the previous user to
75+
a newly created user.
76+
77+
```js
78+
import { Auth } from 'aws-amplify';
79+
80+
async function confirmSignUp() {
81+
try {
82+
await Auth.confirmSignUp(username, code, { forceAliasCreation: false });
83+
} catch (error) {
84+
console.log('error confirming sign up', error);
85+
}
86+
}
87+
```
88+
7189
### Auto sign in after sign up
7290

7391
If you enabled `autoSignIn`, the `sign up` function will dispatch `autoSignIn` hub event after successful confirmation.

0 commit comments

Comments
 (0)