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

Commit

Permalink
Merge branch 'master' of github.com:mulesoft/js-client-oauth2
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoiko committed Apr 2, 2018
2 parents 3281f6f + eb474e6 commit 3374463
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client-oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ TokenFlow.prototype.getToken = function (uri, opts) {

// If no query string or fragment exists, we won't be able to parse
// any useful information from the uri.
if (!url.hash && !url.query) {
if (!url.hash && !url.search) {
return Promise.reject(new TypeError('Unable to process uri: ' + uri))
}

Expand Down
9 changes: 9 additions & 0 deletions test/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,14 @@ describe('token', function () {
})
})
})

it('should fail if token not present', function (done) {
githubAuth.token.getToken(config.redirectUri)
.then(function (ignore) {
done(new Error('Promise should fail'))
}, function (reason) {
done() // Promise is rejected - pass
})
})
})
})

0 comments on commit 3374463

Please sign in to comment.