I’m trying to create authentication system using sanity.
The problem is they have given the documentation in typescript whereas I’m using next js with javascript.
Typescript Code:
import NextAuth, { NextAuthOptions } from 'next-auth';
import GitHub from 'next-auth/providers/github';
import { NextApiRequest, NextApiResponse } from 'next';
import { SanityAdapter, SanityCredentials } from 'next-auth-sanity';
import { client } from 'your/sanity/client';
const options: NextAuthOptions = {
providers: [
GitHub({
clientId: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET
}),
SanityCredentials(client) // only if you use sign in with credentials
],
session: {
strategy: 'jwt'
},
adapter: SanityAdapter(client)
};
export default NextAuth(options);
Can someone help me with this.
how Can I use it in javascript.
the only unfamiliar thing is const options: NextAuthOption = { /* Rest Code */ }