Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Remove constraint on uri pathname matching the... #130

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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