File tree 3 files changed +3
-5
lines changed
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";
6
6
7
7
const fetchSettings = async ( event ) => {
8
8
try {
9
- const address = event . auth . id ;
9
+ const address = event . auth . sub ;
10
10
const lowerCaseAddress = address . toLowerCase ( ) as `0x${string } `;
11
11
12
12
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) => {
63
63
const lowerCaseAddress = address . toLowerCase ( ) as `0x${string } `;
64
64
65
65
// Prevent using someone else's token
66
- if ( event ?. auth ?. id . toLowerCase ( ) !== lowerCaseAddress ) {
66
+ if ( event ?. auth ?. sub . toLowerCase ( ) !== lowerCaseAddress ) {
67
67
throw new Error ( "Unauthorised user" ) ;
68
68
}
69
69
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 = () => {
14
14
}
15
15
16
16
try {
17
- // const secret = process.env.JWT_SECRET;
18
- // TODO testing purpose
19
- const secret = "u03tzA7Un9w+fetret343t6U2YaOlINle1E4avjc=" ;
17
+ const secret = process . env . JWT_SECRET ;
20
18
21
19
if ( ! secret ) {
22
20
throw new Error ( "Secret not set in environment" ) ;
You can’t perform that action at this time.
0 commit comments