Skip to content

Commit

Permalink
Remove constraint on uri pathname matching the...
Browse files Browse the repository at this point in the history
configured redirectUri pathname.

Closes mulesoft-labs#129
  • Loading branch information
jjbeavers-lifeomic committed Dec 27, 2019
1 parent 8005fff commit 6941e5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/client-oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
9 changes: 9 additions & 0 deletions test/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6941e5c

Please sign in to comment.