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 :: deploying to heroku from git 
Shell :: find and kill android device offline on Mac 
Shell :: time machine logs 
Shell :: gitahead fork 
Shell :: adb kill server kali linux 
Shell :: how to delete unwanted built in apps in phone using cmd 
Shell :: awk pdb format 
Shell :: brew compas mongo 
Shell :: take screenshot linux 
Shell :: control pc brightness with shell script mac 
Shell :: copy a file from local machine to docker container 
Shell :: zsh deno command not found 
Shell :: How to list all unit files with systemctl command 
Shell :: how to create tls.crt and tls.key 
Shell :: asp.net existing database 
Shell :: mac unzip terminal 
Shell :: TestStand null char 
Shell :: ubuntu install kde partition manager 
Shell :: ubuntu 16 lock from terminal 
Shell :: linux command line image converter 
Shell :: extract tar.zst zst linux ubnutu 
Shell :: mariadb references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them 
Shell :: how to remove directory with contents in w10 cmd 
Shell :: How to install KVM and VirtManager on Kali Linux 
Shell :: bash remove random files from directory 
Shell :: bash use variable in string 
Shell :: oracle docker images 
Shell :: git remote add origin 
Shell :: how to undo commit 
Shell :: top running port 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =