Skip to content

Commit a770d80

Browse files
Update packages/server/api/src/app/authentication/context/access-token-manager.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 02d062c commit a770d80

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/server/api/src/app/authentication/context/access-token-manager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ export const accessTokenManager = {
3636
expiresInSeconds: number = openOpsRefreshTokenLifetimeSeconds,
3737
): Promise<string> {
3838
const principal = await this.extractPrincipal(userToken);
39+
if (principal.type !== PrincipalType.USER) {
40+
throw new ApplicationError({
41+
code: ErrorCode.INVALID_BEARER_TOKEN,
42+
params: {
43+
message: 'MCP token can only be generated from a USER token',
44+
},
45+
});
46+
}
3947

4048
const secret = await jwtUtils.getJwtSecret();
4149

0 commit comments

Comments
 (0)