From 523b08ce19c9802f7320cc2d8f5710ee2954c753 Mon Sep 17 00:00:00 2001 From: nabeelamjad Date: Mon, 16 Jan 2017 16:08:26 +0000 Subject: [PATCH] Fix device parameter not being whitelisted for authorization (#312) --- src/helper/parameters-whitelist.js | 1 + test/authentication/authentication.test.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/helper/parameters-whitelist.js b/src/helper/parameters-whitelist.js index fdb5f5cb..f2ed9ade 100644 --- a/src/helper/parameters-whitelist.js +++ b/src/helper/parameters-whitelist.js @@ -26,6 +26,7 @@ var authorize_params = [ 'connection_scope', 'auth0Client', 'owp', + 'device', // oauth2 'client_id', 'response_type', diff --git a/test/authentication/authentication.test.js b/test/authentication/authentication.test.js index 2cda228f..077d1e9c 100644 --- a/test/authentication/authentication.test.js +++ b/test/authentication/authentication.test.js @@ -99,6 +99,18 @@ describe('auth0.authentication', function () { expect(url).to.be('https://me.auth0.com/authorize?client_id=...&response_type=token&redirect_uri=http%3A%2F%2Fanotherpage.com%2Fcallback2&state=1234&prompt=none'); }) + + it('should return a url using using whitelisted authorization parameter device', function() { + var url = this.auth0.buildAuthorizeUrl({ + responseType: 'token', + redirectUri: 'http://anotherpage.com/callback2', + prompt: 'none', + state: '1234', + device: 'my-device' + }); + + expect(url).to.be('https://me.auth0.com/authorize?device=my-device&client_id=...&response_type=token&redirect_uri=http%3A%2F%2Fanotherpage.com%2Fcallback2&state=1234&prompt=none'); + }) }) context('buildAuthorizeUrl with Telemetry', function () { @@ -528,4 +540,4 @@ describe('auth0.authentication', function () { }); }); -}) \ No newline at end of file +})