diff --git a/lib/client.js b/lib/client.js index 48c5a3da..94e1879b 100644 --- a/lib/client.js +++ b/lib/client.js @@ -115,6 +115,8 @@ function authorizationParams(params) { delete authParams[key]; } else if (key === 'claims' && typeof value === 'object') { authParams[key] = JSON.stringify(value); + } else if (key === 'resource' && Array.isArray(value)) { + authParams[key] = value; } else if (typeof value !== 'string') { authParams[key] = String(value); } diff --git a/test/client/client_instance.test.js b/test/client/client_instance.test.js index 64a48d00..44b94d65 100644 --- a/test/client/client_instance.test.js +++ b/test/client/client_instance.test.js @@ -132,6 +132,14 @@ describe('Client', () => { }); }); + it('allows resource to passed as an array', function () { + expect(url.parse(this.client.authorizationUrl({ + resource: ['urn:example:com', 'urn:example-2:com'], + }), true).query).to.deep.contain({ + resource: ['urn:example:com', 'urn:example-2:com'], + }); + }); + it('auto-stringifies claims parameter', function () { expect(url.parse(this.client.authorizationUrl({ claims: { id_token: { email: null } },