Skip to content

Commit

Permalink
fix: expose headers on response
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhermeasper committed Apr 28, 2024
1 parent d099f9f commit 9aa0081
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class AuthController {

res.set('Authorization', `Bearer ${encryptedToken}`);
res.set('Refresh-Token', encryptedRefreshToken);
res.set('Access-Control-Expose-Headers', 'Authorization, Refresh-Token');
res.set('Access-Control-Allow-Headers', 'Authorization, Refresh-Token');

return res.status(200).json({ message: 'Authenticated successfully' });
} catch (error) {
Expand Down Expand Up @@ -67,6 +69,8 @@ class AuthController {
const encryptedToken = encryptToken(response.access_token);

res.set('Authorization', `Bearer ${encryptedToken}`);
res.set('Access-Control-Expose-Headers', 'Authorization');
res.set('Access-Control-Allow-Headers', 'Authorization');

return res.status(200).json({ message: 'Token refreshed' });
} catch (error) {
Expand Down

0 comments on commit 9aa0081

Please sign in to comment.