Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

How Do I Send Password Reset Emails from a Backend App Using an Email API?

Here's the full flow the way I've built it, using Notify as the email API. The shape of this is the same regardless of which provider you pick — generate a token, send a link, verify it on submit — so most of this applies no matter what you're using; I'll flag the one part that's specific to Notify. The Flow, End to End User requests a password reset Your backend generates a secure, short-lived…

Resetting a user's password typically involves generating a secure token, sending a reset link via email, and then verifying that token when the user submits a new password. This process can be executed using an email API. Here's a step-by-step breakdown:

1. Generate the Reset Token: Utilize a cryptographically secure random value generator, like the `crypto` module in Node.js. Don't use a guessable value. Store only a hashed version of the token in the database to protect it. Generate a token with a short expiration time, typically 15 to 60 minutes.

2. Build the Reset URL: Construct a URL that includes the reset token as a parameter. This URL will be the link users click to reset their passwords. The hashed token is stored for verification later.

3. Send the Email: Use an email API to send the password reset email. In this example, Notify is used. The process involves making an HTTP POST request to Notify's API endpoint, including the email address, your app's verified domain, and a link with the token. If you want to handle bounced emails, set up a webhook to receive notifications.

4. Verify the Token: When the user submits the new password, verify the token using the same hashing algorithm. Check that the token exists and has not expired. Upon successful verification, update the user's password and invalidate the token to prevent reuse.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I run a surf forecast for 20 breaks in Morocco on EUR 0/month. Here's the stack.

I live on the Taghazout coast in Morocco - a strip of Atlantic between Agadir and Imsouane that's basically one long right-hand point break after another.

  • Operates surf forecast service for 20 breaks along Morocco's Taghazout coast
  • Platform available in 10 languages, zero cost per month
  • Computes confidence flag (agree, mixed, or diverge) for forecast data

Linux Kernel 7.2 Has Been Officially Released with Many New Features

Linux Kernel 7.2 has just been officially released with a slew of new features, reports the blog 9to5Linux. Highlights of Linux 7.2 "include cache-aware load-balancing support, initial HDMI 2.1 FRL…

  • Linux Kernel 7.2 officially released with cache-aware load-balancing support
  • Initial HDMI 2.1 Full Rate Line Rate (FRL) support for AMDGPU driver added
  • Fair(er) GPU scheduler improves graphics processing resource allocation

More from Monday 17 August →