Authentication in Nextjs

This page summarizes the projects mentioned and recommended in the original post on dev.to

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • next-auth-example

  • Preview: https://next-auth-example-mu-two.vercel.app/ Repo: https://github.com/rafaelmagalhaes/next-auth-example

  • DummyJSON

    DummyJSON.com provides different types of REST Endpoints filled with JSON data which you can use in developing the frontend with your favorite framework and library without worrying about writing a backend.

  • import { NextPage } from 'next' import { useState } from 'react' import { setCookie } from 'cookies-next' import { useRouter } from 'next/router' import { useAuthStore } from '~/store/useAuthStore' // import our useAuthStore const SignIn: NextPage = (props) => { // set UserInfo state with inital values const [userInfo] = useState({ email: 'kminchelle', password: '0lelplR' }) const router = useRouter() // import state from AuthStore const setUser = useAuthStore((state) => state.setUser) const setAuthentication = useAuthStore((state) => state.setAuthentication) const login = async () => { // do a post call to the auth endpoint const res = await fetch('https://dummyjson.com/auth/login', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username: userInfo.email, password: userInfo.password, }), }) // check if response was ok if (!res.ok) { return console.error(res) } // retrieve data from the response const data = await res.json() // check if we have data if (data) { setUser(data) // set data to our user state setAuthentication(true) // set our authentication state to true setCookie('token', data?.token) // set token to the cookie router.push('/') // redirect to home page } } return (

    Login

    Username (userInfo.email = event.target.value)} required /> Password (userInfo.password = event.target.value)} name="psw" required /> Login
    ) } export default SignIn

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Next Auth boilerplate TS

    2 projects | dev.to | 17 Apr 2024
  • Integrating GraphQL Codegen + React Query + Clerk JWT Tokens

    2 projects | dev.to | 3 Apr 2024
  • UI for fake REST API challenge. How would you rate my skills?

    2 projects | /r/vuejs | 8 Jun 2023
  • What are some of the simplest web applications and/or API's out there that are popular

    1 project | /r/webdev | 28 May 2023
  • Spacetraders is an online multiplayer game based entirely on APIs. You have to build your own management and UI on your own with any programming language.

    4 projects | /r/programming | 8 May 2023