Add authorization
This commit is contained in:
@@ -12,13 +12,19 @@ export async function tokenRoutes(fastify: FastifyInstance) {
|
||||
201: $token("createTokenResponse"),
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: ["token:write"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
createTokenHandler
|
||||
);
|
||||
|
||||
fastify.get(
|
||||
"/:tokenId",
|
||||
{ schema: { response: { 200: $token("getTokenResponse") } } },
|
||||
{
|
||||
schema: { response: { 200: $token("getTokenResponse") } },
|
||||
config: { requiredClaims: ["token:read"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
getTokenHandler
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user