TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What is the current best-practice for authentication for Apollo/GraphQL?

5 pointsby mrcccover 6 years ago

1 comment

benawadover 6 years ago
1. Create a login mutation which creates a session and sends back a cookie.<p>2. Use resolver middleware to check whether the user is authenticated.<p>I like to use express-session (<a href="https:&#x2F;&#x2F;github.com&#x2F;expressjs&#x2F;session" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;expressjs&#x2F;session</a>) for part 1 and graphql-middleware (<a href="https:&#x2F;&#x2F;github.com&#x2F;prisma&#x2F;graphql-middleware" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;prisma&#x2F;graphql-middleware</a>) for part 2.