Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function OAuthBearer(options: any = {}): Function {
return applyDecorators(
AuthOptions(OAuthBearerOptions as any, options), // Add this to store all options and retrieve it in verify function
UseAuth(Passport.authenticate("oauth-bearer", {session: false, ...options}) as any),
// Metadata for swagger
Security("oauth", ...(options.scopes || [])),
Operation({
"parameters": [
{
"in": "header",
"name": "Authorization",
"type": "string",
"required": true
}
]
}),
Responses(401, {description: "Unauthorized"}),
Responses(403, {description: "Forbidden"}),
OAuthHead()
);
}