I know theres getToken which should get me the token i just dont understand how to call it. i tried doing a get-token.js
// This is an example of how to read a JSON Web Token from an API route
import { getToken } from "next-auth/jwt"
export default async function getToken(req, res) {
// If you don't have NEXTAUTH_SECRET set, you will have to pass your secret as `secret` to `getToken`
const token = await getToken({ req })
if (token) {
// Signed in
console.log("JSON Web Token", JSON.stringify(token, null, 2))
} else {
// Not Signed in
res.status(401)
}
res.end()
}
and then in my signed in page
if (session && session.user){
const response = await fetch(`https://localhost:3000/api/get-token`)
console.log(response)
}
however this got me an error
Cause: [Error: A4280000
0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:
] {
library: 'SSL routines',
reason: 'wrong version number',
code: 'ERR_SSL_WRONG_VERSION_NUMBER'
}