feat: update session handling by changing import source and enhancing token scope
This commit is contained in:
parent
845381e84d
commit
fce459679c
@ -1,4 +1,4 @@
|
|||||||
import { getSession } from "@/authOptions";
|
import { getSession } from "next-auth/react";
|
||||||
import AppWrapper from "./components/AppWrapper";
|
import AppWrapper from "./components/AppWrapper";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { AuthOptions, getServerSession, Session } from "next-auth";
|
import { AuthOptions, Session } from "next-auth";
|
||||||
import { JWT } from "next-auth/jwt";
|
import { JWT } from "next-auth/jwt";
|
||||||
import jsonwebtoken from "jsonwebtoken";
|
import jsonwebtoken from "jsonwebtoken";
|
||||||
import { JWTDecoded } from "./app/types/next-auth";
|
import { JWTDecoded } from "./app/types/next-auth";
|
||||||
import { cache } from "react";
|
|
||||||
|
|
||||||
moment.locale("fr");
|
moment.locale("fr");
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ export const authOptions: AuthOptions = {
|
|||||||
authorization: {
|
authorization: {
|
||||||
url: process.env.OAUTH_AUTHORIZATION_URL,
|
url: process.env.OAUTH_AUTHORIZATION_URL,
|
||||||
params: {
|
params: {
|
||||||
scope: "openid email profile",
|
scope: "openid email profile offline_access",
|
||||||
response_type: "code",
|
response_type: "code",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -139,5 +138,3 @@ const refreshAccessToken = async (token: JWT): Promise<JWT> => {
|
|||||||
|
|
||||||
return refreshPromise;
|
return refreshPromise;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSession = cache(() => getServerSession());
|
|
||||||
|
Loading…
Reference in New Issue
Block a user