Menu

A Next.js app with Garmin sign-in, done properly
📰

A Next.js app with Garmin sign-in, done properly

DEV Community: nextjs·Ivan Ficko·about 23 hours ago
#iH4eitNC
#devtonextjs#devto#dev#garmin#code
Reading 0:00
15s threshold

For developers. Just want to ask Claude about your training, with no code? Start with Your Garmin data in Claude instead.

In Part 1 we signed in to Garmin from a script and printed last night's sleep. A script has it easy: one user, one machine, and a terminal to type the MFA code into.

A web app has none of that. Your users sign in through a form, the MFA code arrives in a second request, and many users' Garmin sessions have to live somewhere safer than a folder. This post builds that properly with garminconnect-js and the Next.js App Router:

Storing each user's Garmin tokens, encrypted, in your own database

Signing in with MFA across two requests, using Server Actions

Reading Garmin data in a Server Component

The security details that are easy to get wrong

Written against garminconnect-js 0.10.0 and Next.js 16. Every snippet here type-checks against those versions.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.