Skip to content

Commit

Permalink
Merge pull request #37 from seanbirchall/development
Browse files Browse the repository at this point in the history
UPDATE: refresh
  • Loading branch information
seanbirchall authored Nov 27, 2024
2 parents dd50232 + 8601160 commit f436406
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions service/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ app.get('/logout', async (req, res) => {
app.get('/refresh', async (req, res) => {
const refreshToken = req.cookies.refresh_token;

if(!refreshToken){
return res.status(400).send('Nothing to refresh');
}

try {
// Attempt to get a new access token using the refresh token
const response = await axios.post(
Expand Down Expand Up @@ -104,6 +108,7 @@ app.get('/refresh', async (req, res) => {
// Refresh token is invalid or expired
res.clearCookie('access_token');
res.clearCookie('refresh_token');
return res.status(400).send('Nothing to refresh');
}
});

Expand Down

0 comments on commit f436406

Please sign in to comment.