Set Up SendGrid
Before we can let users sign in to our app with email, we need a way to send emails.
For that, we are going to use SendGrid.
Go to the SendGrid dashboard.
Navigate to Settings > API Keys.
Click Create API Key.
Enter "email-tutorial"
for the API Key Name.
Under API Key Permissions select Restricted Access. Then, under Access Details, ensure that Mail Send > Mail Send is granted full access.
Click the Create & View button.
The following screen will display your API key. Save it someplace safe, as we will use it later.
Next, navigate to Settings > Sender Authentication.
If you've already verified your domain or email address, it will be displayed here. If not, click Get Started under Verify an Address and complete single sender verification.
Now that we have an API key and a verified email address, let's create a
'.env'
file to store them.
$ touch .env
Add your email and API key. The contents of the file should look something like this:
EMAIL=user@example.com
SENDGRID_API_KEY=__INSERT_API_KEY_HERE__
Next we will configure the strategy.