Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

install next auth

npm i --save next-auth
Comment

Install next-auth npm package in nextjs

npm i next-auth@latest
Comment

install next-auth

import { useSession, signIn, signOut } from "next-auth/client"

export default function Component() {
  const [session, loading] = useSession()
  if (session) {
    return (
      <>
        Signed in as {session.user.email} <br />
        <button onClick={() => signOut()}>Sign out</button>
      </>
    )
  }
  return (
    <>
      Not signed in <br />
      <button onClick={() => signIn()}>Sign in</button>
    </>
  )
}
Comment

install next-auth

import NextAuth from "next-auth"
import Providers from "next-auth/providers"

export default NextAuth({
  providers: [
    // OAuth authentication providers
    Providers.Apple({
      clientId: process.env.APPLE_ID,
      clientSecret: process.env.APPLE_SECRET,
    }),
    Providers.Google({
      clientId: process.env.GOOGLE_ID,
      clientSecret: process.env.GOOGLE_SECRET,
    }),
    // Sign in with passwordless email link
    Providers.Email({
      server: process.env.MAIL_SERVER,
      from: "<no-reply@example.com>",
    }),
  ],
  // SQL or MongoDB database (or leave empty)
  database: process.env.DATABASE_URL,
})
Comment

PREVIOUS NEXT
Code Example
Shell :: xlsx Module ../../xlsx/types has no exported member IProperties. Did you mean Properties? 
Shell :: linux open file explorer from terminal 
Shell :: code . zsh command not found wsl 
Shell :: stylelint run 
Shell :: trojitá ubuntu 
Shell :: uninstall openshot linux 
Shell :: how to uninstall programms on ubuntu 
Shell :: change partition in cmd 
Shell :: how to install .deb file on termux 
Shell :: ubuntu video player 
Shell :: suid privilege escalation systemctl 
Shell :: ubuntu remove directory 
Shell :: yarn test only one file 
Shell :: how upgrade my notebook 
Shell :: openbullet 2 kali linux 
Shell :: bash get file name 
Shell :: download adobe reader linux 
Shell :: powerline fonts install 
Shell :: paru install 
Shell :: getkirby install editor 
Shell :: create a ssh key 
Shell :: install nodejs ubuntu 
Shell :: update yarn version 
Shell :: firefox hide password warning 
Shell :: polyblog install command 
Shell :: command to upgrade upgradable packages on Ubuntu 
Shell :: how to stop apache2 service in kali linux 
Shell :: wget download to specific directory 
Shell :: ufw allow ssh 
Shell :: notify once a job is completed 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =