# Authentication in JavaScript & TypeScript

DevFeed: [Authentication in JavaScript & TypeScript](<https://devfeed.tech/articles/authentication-in-javascript-typescript-18940.md>)

Original publisher: [Read original article](<https://www.robinwieruch.de/how-to-roll-your-own-auth/>)

Author: Robin Wieruch

Published: 2024-10-29T10:50:46Z

Content type: tutorial

Language: en

Sources: [Robin Wieruch](<https://devfeed.tech/sources/robin-wieruch.md>)

Topics: [Authentication](<https://devfeed.tech/topics/authentication.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Database](<https://devfeed.tech/topics/database.md>), [passwords](<https://devfeed.tech/topics/passwords.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Express](<https://devfeed.tech/topics/express.md>), [Next.js](<https://devfeed.tech/topics/next-js.md>), [Prisma](<https://devfeed.tech/topics/prisma.md>)

Tags: [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [backend](<https://devfeed.tech/tags/backend.md>), [browser](<https://devfeed.tech/tags/browser.md>), [database](<https://devfeed.tech/tags/database.md>), [express](<https://devfeed.tech/tags/express.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [javascript-authentication](<https://devfeed.tech/tags/javascript-authentication.md>), [learn](<https://devfeed.tech/tags/learn.md>), [next-js](<https://devfeed.tech/tags/next-js.md>), [password](<https://devfeed.tech/tags/password.md>), [passwords](<https://devfeed.tech/tags/passwords.md>), [prisma](<https://devfeed.tech/tags/prisma.md>), [security](<https://devfeed.tech/tags/security.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

This tutorial explains how to build session-based authentication in a JavaScript or TypeScript application. It covers storing users and sessions in a database, setting session-token cookies, validating sessions on server requests, and hashing passwords instead of storing them in plain text.

## Source excerpt

Learn how to roll your own authentication in JavaScript & TypeScript ...