mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 05:09:26 +00:00
add x-auth-skip header
This commit is contained in:
@@ -35,7 +35,7 @@ async function bootstrap() {
|
||||
})
|
||||
pipesSetup(app)
|
||||
app.useGlobalFilters(new HttpExceptionFilter())
|
||||
await app.listen(process.env.PORT || 3000)
|
||||
await app.listen(process.env.PORT || 3333)
|
||||
const logger = new Logger('NestApplication')
|
||||
|
||||
logger.log(`Application is running on: ${await app.getUrl()}`)
|
||||
|
||||
@@ -35,9 +35,15 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
}
|
||||
|
||||
private static extractJWT(req: RequestType): string | null {
|
||||
const permanentToken =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJmMmJlOTViOS00ZDA3LTQ3NTEtYTc3NS1iZDYxMmZjOTU1M2EiLCJkYXRlIjoiMjAyMy0wOC0wNVQxMTowMjoxNC42MjFaIiwiaWF0IjoxNjkxMjMzMzM0LCJleHAiOjIwMDY4MDkzMzR9.PGTRcsf34VFaS-Hz7_PUnWR8bBuVK7pdteBWUUYHXfw'
|
||||
|
||||
if (req.cookies && 'accessToken' in req.cookies && req.cookies.accessToken.length > 0) {
|
||||
return req.cookies.accessToken
|
||||
}
|
||||
if (req.headers['x-auth-skip'] === 'true') {
|
||||
return permanentToken
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user