Skip to content

Commit

Permalink
chore:
Browse files Browse the repository at this point in the history
  • Loading branch information
이은상 committed Dec 26, 2024
1 parent 1e4cdc4 commit 3616152
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 7_auth/7_1_express_js/src/controllers/GitHubController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ export class GithubController {
async callback(req: Request, res: Response) {
const { code, state } = req.query;

// debug
console.log(req.cookies.query('state'));

// Validate the state parameter to prevent CSRF attacks
const storedState = req.cookies['state'];

if (!storedState || storedState !== state) {
res.status(400).send({ error: "State mismatch" });
}
Expand Down

0 comments on commit 3616152

Please sign in to comment.