feat: update session handling by changing import source and enhancing token scope

This commit is contained in:
Rémi 2025-01-06 16:51:30 +01:00
parent 845381e84d
commit fce459679c
2 changed files with 3 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { getSession } from "@/authOptions";
import { getSession } from "next-auth/react";
import AppWrapper from "./components/AppWrapper";
import "./globals.css";

View File

@ -1,10 +1,9 @@
import axios from "axios";
import moment from "moment";
import { AuthOptions, getServerSession, Session } from "next-auth";
import { AuthOptions, Session } from "next-auth";
import { JWT } from "next-auth/jwt";
import jsonwebtoken from "jsonwebtoken";
import { JWTDecoded } from "./app/types/next-auth";
import { cache } from "react";
moment.locale("fr");
@ -19,7 +18,7 @@ export const authOptions: AuthOptions = {
authorization: {
url: process.env.OAUTH_AUTHORIZATION_URL,
params: {
scope: "openid email profile",
scope: "openid email profile offline_access",
response_type: "code",
},
},
@ -139,5 +138,3 @@ const refreshAccessToken = async (token: JWT): Promise<JWT> => {
return refreshPromise;
};
export const getSession = cache(() => getServerSession());