voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
57 lines (39 loc) • 1.86 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [sendSignInLinkToEmail](./auth.sendsigninlinktoemail.md)
## sendSignInLinkToEmail() function
Sends a sign-in email link to the user with the specified email.
<b>Signature:</b>
```typescript
export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| auth | [Auth](./auth.auth.md) | |
| email | string | The user's email address. |
| actionCodeSettings | [ActionCodeSettings](./auth.actioncodesettings.md) | The [ActionCodeSettings](./auth.actioncodesettings.md)<!-- -->. |
<b>Returns:</b>
Promise<void>
## Remarks
The sign-in operation has to always be completed in the app unlike other out of band email actions (password reset and email verifications). This is because, at the end of the flow, the user is expected to be signed in and their Auth state persisted within the app.
To complete sign in with the email link, call [signInWithEmailLink()](./auth.signinwithemaillink.md) with the email address and the email link supplied in the email sent to the user.
## Example
```javascript
const actionCodeSettings = {
url: 'https://www.example.com/?email=user@example.com',
iOS: {
bundleId: 'com.example.ios'
},
android: {
packageName: 'com.example.android',
installApp: true,
minimumVersion: '12'
},
handleCodeInApp: true
};
await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
// Obtain emailLink from the user.
if(isSignInWithEmailLink(auth, emailLink)) {
await signInWithEmailLink('user@example.com', 'user@example.com', emailLink);
}
```