File tree Expand file tree Collapse file tree 3 files changed +3
-5
lines changed Expand file tree Collapse file tree 3 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { authMiddleware } from "../middleware/authMiddleware";
66
77const fetchSettings = async ( event ) => {
88 try {
9- const address = event . auth . id ;
9+ const address = event . auth . sub ;
1010 const lowerCaseAddress = address . toLowerCase ( ) as `0x${string } `;
1111
1212 const supabase = createClient < Database > ( process . env . SUPABASE_URL ! , process . env . SUPABASE_CLIENT_API_KEY ! ) ;
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ const updateSettings = async (event) => {
6363 const lowerCaseAddress = address . toLowerCase ( ) as `0x${string } `;
6464
6565 // Prevent using someone else's token
66- if ( event ?. auth ?. id . toLowerCase ( ) !== lowerCaseAddress ) {
66+ if ( event ?. auth ?. sub . toLowerCase ( ) !== lowerCaseAddress ) {
6767 throw new Error ( "Unauthorised user" ) ;
6868 }
6969 const supabase = createClient < Database > ( process . env . SUPABASE_URL ! , process . env . SUPABASE_CLIENT_API_KEY ! ) ;
Original file line number Diff line number Diff line change @@ -14,9 +14,7 @@ export const authMiddleware = () => {
1414 }
1515
1616 try {
17- // const secret = process.env.JWT_SECRET;
18- // TODO testing purpose
19- const secret = "u03tzA7Un9w+fetret343t6U2YaOlINle1E4avjc=" ;
17+ const secret = process . env . JWT_SECRET ;
2018
2119 if ( ! secret ) {
2220 throw new Error ( "Secret not set in environment" ) ;
You can’t perform that action at this time.
0 commit comments