client-oauth2
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -483,13 +483,13 @@ var extend = require('xtend') | ||
// Make sure the uri matches our expected redirect uri. | ||
if (uri.substr(0, options.redirectUri.length) !== options.redirectUri) { | ||
return Promise.reject(new Error('Should match redirect uri: ' + uri)) | ||
var url = parseUrl(uri) | ||
var expectedUrl = parseUrl(options.redirectUri) | ||
if (url.pathname !== expectedUrl.pathname) { | ||
return Promise.reject(new TypeError('Should match redirect uri: ' + uri)) | ||
} | ||
var url = parseUrl(uri) | ||
// If no query string or fragment exists, we won't be able to parse | ||
// any useful information from the uri. | ||
if (!url.hash && !url.search) { | ||
return Promise.reject(new Error('Unable to process uri: ' + uri)) | ||
return Promise.reject(new TypeError('Unable to process uri: ' + uri)) | ||
} | ||
@@ -514,3 +514,3 @@ | ||
if (state != null && data.state !== state) { | ||
return Promise.reject(new Error('Invalid state: ' + data.state)) | ||
return Promise.reject(new TypeError('Invalid state: ' + data.state)) | ||
} | ||
@@ -610,11 +610,11 @@ | ||
// Make sure the uri matches our expected redirect uri. | ||
if (uri.substr(0, options.redirectUri.length) !== options.redirectUri) { | ||
return Promise.reject(new Error('Should match redirect uri: ' + uri)) | ||
var url = parseUrl(uri) | ||
var expectedUrl = parseUrl(options.redirectUri) | ||
if (url.pathname !== expectedUrl.pathname) { | ||
return Promise.reject(new TypeError('Should match redirect uri: ' + uri)) | ||
} | ||
var url = parseUrl(uri) | ||
if (!url.search) { | ||
return Promise.reject(new Error('Unable to process uri: ' + uri)) | ||
return Promise.reject(new TypeError('Unable to process uri: ' + uri)) | ||
} | ||
@@ -630,3 +630,3 @@ | ||
if (state && data.state !== state) { | ||
return Promise.reject(new Error('Invalid state:' + data.state)) | ||
return Promise.reject(new TypeError('Invalid state:' + data.state)) | ||
} | ||
@@ -636,3 +636,3 @@ | ||
if (!data.code) { | ||
return Promise.reject(new Error('Missing code, unable to request token')) | ||
return Promise.reject(new TypeError('Missing code, unable to request token')) | ||
} | ||
@@ -639,0 +639,0 @@ |
{ | ||
"name": "client-oauth2", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Straight-forward execution of OAuth 2.0 flows and authenticated API requests", | ||
@@ -5,0 +5,0 @@ "main": "client-oauth2.js", |
@@ -77,3 +77,3 @@ # Client OAuth 2.0 | ||
var express = require('express') | ||
var app = express() | ||
var app = express() | ||
@@ -80,0 +80,0 @@ app.get('/auth/github', function (req, res) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27496