diff --git a/src/test/integration/oauth-test.ts b/src/test/integration/oauth-test.ts index 241302bf4..0f7118476 100644 --- a/src/test/integration/oauth-test.ts +++ b/src/test/integration/oauth-test.ts @@ -162,6 +162,27 @@ describe('oauth/', function () { customCallbackHandler = customCallbackHandlerProvided || null; } + it('serves OAuth metadata', async () => { + const res = await chai + .request(server) + .keepOpen() + .get('/.well-known/oauth-authorization-server') + .set('Accept', 'application/json'); + expect(res.status).toEqual(200); + expect(res.body).toHaveProperty('issuer'); + expect(res.body).toHaveProperty('authorization_endpoint'); + expect(res.body.authorization_endpoint).toEqual(expect.stringContaining('authorize')); + expect(res.body).toHaveProperty('token_endpoint'); + expect(res.body.token_endpoint).toEqual(expect.stringContaining('token')); + expect(res.body).toHaveProperty('response_types_supported'); + expect(res.body.response_types_supported.length).toEqual(1); + expect(res.body.response_types_supported[0]).toEqual('code'); + expect(res.body).toHaveProperty('scopes_supported'); + expect(res.body.scopes_supported.length).toEqual(2); + expect(res.body.scopes_supported).toContain('/things'); + expect(res.body.scopes_supported).toContain('/things:readwrite'); + }); + it('performs simple authorization', async () => { setupOAuth();