Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions harness-tests/core/shared-oauth-db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,27 @@ describe.skipIf(!fixture.url)('OAuth grants in PostgreSQL', () => {
})
})

it('revokes access tokens created by legacy-scope refresh', async () => {
const code = await createAuthorizationCode({
userId,
clientId,
redirectUri,
codeChallenge: challenge,
})
const issued = await exchangeAuthorizationCode({
code,
codeVerifier: verifier,
redirectUri,
})
if (!issued.success) throw new Error(issued.error)
const refreshed = await refreshAccessToken(issued.refreshToken)
if (!refreshed.success) throw new Error(refreshed.error)
await revokeOAuthGrant(issued.refreshToken, clientId)
expect((await validateOAuthToken(refreshed.accessToken)).success).toBe(
false,
)
})

it('requires service authentication for introspection and isolates identity grants', async () => {
const issued = await issue()
const request = (authorization: string) =>
Expand Down
1 change: 1 addition & 0 deletions src/auth/oauthClient.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ export async function refreshAccessToken(
userId: token.userId,
clientId: token.clientId,
scope: 'api',
grantId: token.grantId,
expiresAt: accessExpiresAt,
})
.returning({ id: oauthAccessTokens.id })
Expand Down
Loading