File tree 4 files changed +6
-6
lines changed
puter-js/src/modules/FileSystem
4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1146,8 +1146,8 @@ async function jwt_auth(req){
1146
1146
else if ( req . query && req . query . auth_token )
1147
1147
token = req . query . auth_token ;
1148
1148
// Socket
1149
- else if ( req . handshake && req . handshake . query && req . handshake . query . auth_token )
1150
- token = req . handshake . query . auth_token ;
1149
+ else if ( req . handshake && req . handshake . auth && req . handshake . auth . auth_token )
1150
+ token = req . handshake . auth . auth_token ;
1151
1151
1152
1152
if ( ! token || token === 'null' )
1153
1153
throw ( 'No auth token found' ) ;
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ class WebServerService extends BaseService {
158
158
159
159
// Socket.io middleware for authentication
160
160
socketio . use ( async ( socket , next ) => {
161
- if ( socket . handshake . query . auth_token ) {
161
+ if ( socket . handshake . auth . auth_token ) {
162
162
try {
163
163
let auth_res = await jwt_auth ( socket ) ;
164
164
// successful auth
@@ -168,7 +168,7 @@ class WebServerService extends BaseService {
168
168
socket . join ( socket . user . id ) ;
169
169
next ( ) ;
170
170
} catch ( e ) {
171
- console . log ( 'socket auth err' ) ;
171
+ console . log ( 'socket auth err' , e ) ;
172
172
}
173
173
}
174
174
} ) ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class FileSystem{
65
65
}
66
66
67
67
this . socket = io ( this . APIOrigin , {
68
- query : {
68
+ auth : {
69
69
auth_token : this . authToken ,
70
70
}
71
71
} ) ;
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ async function UIDesktop(options){
43
43
44
44
// connect socket.
45
45
window . socket = io ( window . gui_origin + '/' , {
46
- query : {
46
+ auth : {
47
47
auth_token : window . auth_token
48
48
}
49
49
} ) ;
You can’t perform that action at this time.
0 commit comments