Skip to content

Commit

Permalink
Merge pull request #91 from DigiChanges/fix/LC/refresh-token
Browse files Browse the repository at this point in the history
fix: refresh token koa
  • Loading branch information
Murzbul authored Mar 2, 2022
2 parents e35f95a + c03be28 commit 9e8cea9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/App/Presentation/Shared/Koa/AppKoa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class AppKoa implements IApp

public initConfig()
{
this.app.use(cors());
this.app.use(cors({
credentials: true
}));
this.app.proxy = MainConfig.getInstance().getConfig().env === 'production';
this.app.use(helmet());
this.app.use(hbshbs.middleware({
viewPath: this.config.viewRouteEngine
Expand Down
3 changes: 3 additions & 0 deletions src/Auth/Presentation/Handlers/Express/AuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import RegisterRequest from '../../Requests/RegisterRequest';
import UpdateMeRequest from '../../Requests/UpdateMeRequest';
import VerifyYourAccountRequest from '../../Requests/VerifyYourAccountRequest';
import RefreshTokenMiddleware from '../../Middlewares/Express/RefreshTokenMiddleware';
import MainConfig from '../../../../Config/mainConfig';

@controller('/api/auth')
class AuthHandler
Expand Down Expand Up @@ -68,6 +69,7 @@ class AuthHandler
expires: moment.unix(payload.getExpires()).toDate(),
maxAge: payload.getExpires(),
path: '/api/auth/refresh-token',
secure: MainConfig.getInstance().getConfig().env === 'production',
httpOnly: true
});

Expand Down Expand Up @@ -108,6 +110,7 @@ class AuthHandler
expires: moment.unix(payload.getExpires()).toDate(),
maxAge: payload.getExpires(),
path: '/api/auth/refresh-token',
secure: MainConfig.getInstance().getConfig().env === 'production',
httpOnly: true
});

Expand Down

0 comments on commit 9e8cea9

Please sign in to comment.