Skip to content

Commit

Permalink
Get userId from auth response
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper committed Jul 24, 2024
1 parent e92524b commit 9733370
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
9 changes: 0 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"dependencies": {
"@y/redis": "^0.1.4",
"jwt-decode": "^4.0.0",
"lib0": "^0.2.93",
"uws": "github:uNetworking/uWebSockets.js#v20.40.0",
"y-protocols": "^1.0.6"
Expand Down
5 changes: 2 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// @ts-nocheck

import { registerYWebsocketServer } from '@y/redis';
import { jwtDecode } from 'jwt-decode';
import * as env from 'lib0/environment';
import * as error from 'lib0/error';
import * as logging from 'lib0/logging';
Expand Down Expand Up @@ -58,11 +57,11 @@ const checkAuthz = async (req) => {
throw new Error('Missing Token');
}

const { userId } = jwtDecode(token);

const requestOptions = createAuthzRequestOptions(room, token);
const response = await fetch(`${apiHost}/api/v3/authorization/by-reference`, requestOptions);

const { userId } = await response.json();

console.log('checkAuthz response', response);

if (!response.ok) {
Expand Down

0 comments on commit 9733370

Please sign in to comment.