Skip to content

Commit dce8f04

Browse files
committed
update endpoints
1 parent 0880889 commit dce8f04

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/passport-paypal-oauth/strategy.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ var util = require('util')
4242
*/
4343
function Strategy(options, verify) {
4444
options = options || {};
45-
options.authorizationURL = options.authorizationURL || 'https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize';
46-
options.tokenURL = options.tokenURL || 'https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice';
45+
options.authorizationURL = options.authorizationURL || 'https://www.paypal.com/signin/authorize';
46+
options.tokenURL = options.tokenURL || 'https://api.paypal.com/v1/identity/openidconnect/tokenservice';
4747

4848
OAuth2Strategy.call(this, options, verify);
4949
this.name = 'paypal';
5050

5151
this._oauth2.setAccessTokenName("oauth_token");
52+
this._oauth2.useAuthorizationHeaderforGET(true);
5253
}
5354

5455
/**
@@ -79,7 +80,7 @@ var USER_IR_PREFIX = 'https://www.paypal.com/webapps/auth/identity/user/';
7980
* @api protected
8081
*/
8182
Strategy.prototype.userProfile = function(accessToken, done) {
82-
this._oauth2.getProtectedResource('https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/userinfo?schema=openid', accessToken, function (err, body, res) {
83+
this._oauth2.get('https://api.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid', accessToken, function (err, body, res) {
8384
if (err) { return done(new InternalOAuthError('failed to fetch user profile', err)); }
8485

8586
try {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "passport-paypal-oauth",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"description": "PayPal (OAuth) authentication strategy for Passport.",
55
"keywords": [
66
"passport",

test/strategy-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ vows.describe('PayPalStrategy').addBatch({
2929
function() {});
3030

3131
// mock
32-
strategy._oauth2.getProtectedResource = function(url, accessToken, callback) {
32+
strategy._oauth2.get = function(url, accessToken, callback) {
3333
var body = '{"user_id": "123456789","name": "Jared Hanson","given_name": "Jared","family_name": "Hanson", "email": "[email protected]" }';
3434

3535
callback(null, body, undefined);
@@ -79,7 +79,7 @@ vows.describe('PayPalStrategy').addBatch({
7979
function() {});
8080

8181
// mock
82-
strategy._oauth2.getProtectedResource = function(url, accessToken, callback) {
82+
strategy._oauth2.get = function(url, accessToken, callback) {
8383
var body = '{"user_id": "https://www.paypal.com/webapps/auth/identity/user/123456789","name": "Jared Hanson","given_name": "Jared","family_name": "Hanson", "email": "[email protected]" }';
8484

8585
callback(null, body, undefined);
@@ -115,7 +115,7 @@ vows.describe('PayPalStrategy').addBatch({
115115
function() {});
116116

117117
// mock
118-
strategy._oauth2.getProtectedResource = function(url, accessToken, callback) {
118+
strategy._oauth2.get = function(url, accessToken, callback) {
119119
callback(new Error('something-went-wrong'));
120120
}
121121

0 commit comments

Comments
 (0)