Skip to content

Commit e7898ad

Browse files
authored
Merge pull request #593 from ovolynets/update-am-token-base-url
Replaced deprecated OAuth2 access token URL with the recommended URL
2 parents 88ba17f + 45dc6d1 commit e7898ad

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var secrets = require('./secrets');
1616
var console = require('./log');
1717

1818
const ACCOUNT_MANAGER_HOST = 'account.demandware.com';
19-
const ACCOUNT_MANAGER_TOKEN_PATH = '/dw/oauth2/access_token';
19+
const ACCOUNT_MANAGER_TOKEN_PATH = '/dwsso/oauth2/access_token';
2020
const ACCOUNT_MANAGER_AUTH_PATH = '/dwsso/oauth2/authorize?client_id=%s&redirect_uri=%s&response_type=%s';
2121
const OAUTH_LOCAL_PORT_DEFAULT = 8080;
2222
const OAUTH_LOCAL_PORT = getOauthPort(); // overwriting the port requires to update the client_id settings in AM, can be overwritten with env var SFCC_OAUTH_LOCAL_PORT

test/unit/auth.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('Tests for lib/auth.js', function() {
102102
auth.auth(clientKey, clientSecret);
103103
const postArgs = requestStub.post.getCall(0).args[0];
104104
expect(postArgs.form.grant_type).to.equal('client_credentials');
105-
expect(postArgs.uri).to.equal('https://account.demandware.com/dw/oauth2/access_token');
105+
expect(postArgs.uri).to.equal('https://account.demandware.com/dwsso/oauth2/access_token');
106106
expect(postArgs.json).to.be.true;
107107
expect(postArgs.auth.user).to.equal(clientKey);
108108
expect(postArgs.auth.pass).to.equal(clientSecret);
@@ -120,7 +120,7 @@ describe('Tests for lib/auth.js', function() {
120120
const accountManager = AMURI1;
121121
auth.auth(clientKey, clientSecret, null, null, false, accountManager);
122122
const postArgs = requestStub.post.getCall(0).args[0];
123-
expect(postArgs.uri).to.equal('https://account-pod5.demandware.net/dw/oauth2/access_token');
123+
expect(postArgs.uri).to.equal('https://account-pod5.demandware.net/dwsso/oauth2/access_token');
124124
});
125125

126126
it('will look up client/secret from secrets if needed', function() {
@@ -135,15 +135,15 @@ describe('Tests for lib/auth.js', function() {
135135
dwjsonMock['account-manager'] = AMURI2;
136136
auth.auth();
137137
const postArgs = requestStub.post.getCall(0).args[0];
138-
expect(postArgs.uri).to.equal('https://account-pod99.demandware.edu/dw/oauth2/access_token');
138+
expect(postArgs.uri).to.equal('https://account-pod99.demandware.edu/dwsso/oauth2/access_token');
139139
});
140140

141141
it('will use accountManager function arg over dwjson config value', function() {
142142
const accountManager = AMURI1;
143143
dwjsonMock['account-manager'] = AMURI2;
144144
auth.auth(clientKey, clientSecret, null, null, false, accountManager);
145145
const postArgs = requestStub.post.getCall(0).args[0];
146-
expect(postArgs.uri).to.equal('https://account-pod5.demandware.net/dw/oauth2/access_token');
146+
expect(postArgs.uri).to.equal('https://account-pod5.demandware.net/dwsso/oauth2/access_token');
147147
});
148148

149149
it('use password grant type if no grantType param is provided', function() {

0 commit comments

Comments
 (0)