---
title: "Discussion on \"Authentication for Next.js using Firebase\" | Hashnode"
description: "Discussion on \"Authentication for Next.js using Firebase\". On my Next.js project, I wanted to add some authentication. I decided to use Firebase for my user management and data store.\nWhat I needed:\n\nOAuth using Twitter\nclient-side authentication\nProtected pages\nserver-side authentication\n\n\nAssumptions: You ..."
url: "https://hashnode.com/posts/authentication-for-nextjs-using-firebase/5f85a7f100106b423de17f09"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Authentication for Next.js using Firebase](https://blog.codebycorey.com/authentication-for-nextjs-using-firebase?utm_source=hashnode&utm_medium=feed)

On my Next.js project, I wanted to add some authentication. I decided to use Firebase for my user management and data store. What I needed: OAuth using Twitter client-side authentication Protected pages server-side authentication Assumptions: You ...

Oct 13, 2020 · 10 min read · blog.codebycorey.com  
Updated Dec 3, 2020  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#typescript](https://hashnode.com/tag/typescript)
-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#firebase](https://hashnode.com/tag/firebase)
-   [#programming](https://hashnode.com/tag/programming)

## Written by

[Corey O'Donnell](https://hashnode.com/@CodeByCorey)

@CodeByCorey

  
[View profile](https://hashnode.com/@CodeByCorey)

Full-Stack Web Developer 💻 | Always Learning 📖 | Love for Plants 🌱

## Responses 2

Markdown supported · ⌘↵ to post

[Songs Le](https://hashnode.com/@songsle)

[Oct 16, 2020](https://hashnode.com/posts/authentication-for-nextjs-using-firebase/5f85a7f100106b423de17f09/comment/5f897975d7dc0b17a97a1f07)

There's no server side auth present in this article btw. The one you mentioned at the last is only for validating apis. So, auth on nextjs pages still rendered on client side. Only solution as given by firebase auth is to use service-worker or to create cookies. Btw, very good article. It's a clean code.

[Corey O'Donnell](https://hashnode.com/@CodeByCorey)

[Oct 16, 2020](https://hashnode.com/posts/authentication-for-nextjs-using-firebase/5f85a7f100106b423de17f09/comment/5f897975d7dc0b17a97a1f07#reply-5f89b624d7dc0b17a97a2210)

Maybe I should have labeled it as API authentication and not server-side.

The reason I did not include it is that I felt the redirect was more than enough.

Performing a redirect on the server is not fully supported by Next.js causing a total reload since it is not using Next.js's router.

[Catalin Pit](https://hashnode.com/@Catalinpit)

[Oct 13, 2020](https://hashnode.com/posts/authentication-for-nextjs-using-firebase/5f85a7f100106b423de17f09/comment/5f85ad1c00106b423de17f5c)

This is an article I was looking for. Super useful, well done! :-)

[Corey O'Donnell](https://hashnode.com/@CodeByCorey)

[Oct 13, 2020](https://hashnode.com/posts/authentication-for-nextjs-using-firebase/5f85a7f100106b423de17f09/comment/5f85ad1c00106b423de17f5c#reply-5f85ad7800106b423de17f73)

I am currently working on a repository with a blank app so people can refer to that if people don't want to piece together my code snippets.

[Corey O'Donnell](https://hashnode.com/@CodeByCorey)

[Oct 14, 2020](https://hashnode.com/posts/authentication-for-nextjs-using-firebase/5f85a7f100106b423de17f09/comment/5f85ad1c00106b423de17f5c#reply-5f864d3b76870f43aa09d085)

I edited the article to include the repository in the conclusion.
