From 6941e5c969ef3ea7bf670ca6fe651164b6052681 Mon Sep 17 00:00:00 2001 From: James Beavers Date: Fri, 27 Dec 2019 17:45:21 -0500 Subject: [PATCH] Remove constraint on uri pathname matching the... configured redirectUri pathname. Closes #129 --- src/client-oauth2.js | 10 ---------- test/code.js | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/client-oauth2.js b/src/client-oauth2.js index 612d6e2..9cde167 100644 --- a/src/client-oauth2.js +++ b/src/client-oauth2.js @@ -582,16 +582,6 @@ CodeFlow.prototype.getToken = function (uri, opts) { var url = typeof uri === 'object' ? uri : Url.parse(uri, true) - if ( - typeof options.redirectUri === 'string' && - typeof url.pathname === 'string' && - url.pathname !== Url.parse(options.redirectUri).pathname - ) { - return Promise.reject( - new TypeError('Redirected path should match configured path, but got: ' + url.pathname) - ) - } - if (!url.query) { return Promise.reject(new TypeError('Unable to process uri: ' + uri)) } diff --git a/test/code.js b/test/code.js index f309e3d..a21afd8 100644 --- a/test/code.js +++ b/test/code.js @@ -36,6 +36,15 @@ describe('code', function () { }) }) + it('uri pathname and redirectUri pathname should not have to match', function () { + return githubAuth.code.getToken(uri, { + redirectUri: config.redirectUri + '/someOtherJunk' + }) + .then(function (user) { + expect(user.accessToken).to.equal(config.accessToken) + }) + }) + it('should reject with auth errors', function () { var errored = false