mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-08-10 11:50:44 +08:00
Merge pull request #920 from LAION-AI/857-backend-token-decrypt
857 backend token decrypt
This commit is contained in:
@@ -6,8 +6,11 @@ const headers = {
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
// Create Axios such that we always send credential cookies along with the
|
||||
// request. This allows the Backend services to authenticate the user.
|
||||
const api = axios.create({
|
||||
headers,
|
||||
withCredentials: true,
|
||||
});
|
||||
|
||||
export const get = (url: string) => api.get(url).then((res) => res.data);
|
||||
|
||||
@@ -148,6 +148,21 @@ export const authOptions: AuthOptions = {
|
||||
}
|
||||
},
|
||||
},
|
||||
/*
|
||||
* We maybe need this, we maybe don't. Checking in this uncommented until
|
||||
* it's confirmed we can drop this.
|
||||
cookies: {
|
||||
sessionToken: {
|
||||
name: `next-auth.session-token`,
|
||||
options: {
|
||||
httpOnly: true,
|
||||
sameSite: "none",
|
||||
path: "/",
|
||||
secure: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
*/
|
||||
session: {
|
||||
strategy: "jwt",
|
||||
},
|
||||
|
||||
@@ -11,6 +11,9 @@ export { getDefaultStaticProps as getStaticProps } from "src/lib/default_static_
|
||||
import useSWR from "swr";
|
||||
|
||||
const Dashboard = () => {
|
||||
// Adding a demonstrative call to the backend that includes the web's JWT.
|
||||
useSWR(`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/v1/auth/check`, get);
|
||||
|
||||
const {
|
||||
t,
|
||||
i18n: { language },
|
||||
|
||||
Reference in New Issue
Block a user