Support upscoping on insufficient_scope 403 (#1115)
Co-authored-by: Paul Carleton <paulc@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
This commit is contained in:
parent
fc4a6ecb40
commit
3485a06f85
1 changed files with 172 additions and 10 deletions
|
|
@ -95,6 +95,16 @@ describe('OAuth Authorization', () => {
|
|||
|
||||
expect(extractWWWAuthenticateParams(mockResponse)).toEqual({ scope: scope });
|
||||
});
|
||||
|
||||
it('returns error when present', async () => {
|
||||
const mockResponse = {
|
||||
headers: {
|
||||
get: vi.fn(name => (name === 'WWW-Authenticate' ? `Bearer error="insufficient_scope", scope="admin"` : null))
|
||||
}
|
||||
} as unknown as Response;
|
||||
|
||||
expect(extractWWWAuthenticateParams(mockResponse)).toEqual({ error: 'insufficient_scope', scope: 'admin' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('discoverOAuthProtectedResourceMetadata', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue