Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use password option #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Reporter {

let newTokenWasGenerated = false;

return this.fetch(this.config.salesUrl, '[Sales.viewToken]', true)
return this.fetch(this.config.salesUrl, '[Sales.viewToken]', { usePassword: true })
.then((result) => {
if (result.ViewToken.Message != null) return null;

Expand All @@ -154,13 +154,13 @@ class Reporter {
const url = this.config.salesUrl; // Doesn't matter
const params = '[Sales.generateToken]';

return this.fetchRaw(url, params, true)
return this.fetchRaw(url, params, { usePassword: true })
.then((intermediateResponse) => {
// To complete this kind of request, we have to make another request with some
// particular URL params, referencing the service request id passed in these response headers
const requestId = intermediateResponse.headers.service_request_id;
// Do a regular fetch so the result will get parsed
return this.fetchRaw(`${url}?isExistingToken=Y&requestId=${requestId}`, params, true);
return this.fetchRaw(`${url}?isExistingToken=Y&requestId=${requestId}`, params, { usePassword: true });
})
.then((response) => Reporter.handleFetchResponse(this.config.mode, response))
.then((accessTokenResponse) => accessTokenResponse.ViewToken.AccessToken[0]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apple-reporter",
"version": "2.2.2",
"version": "2.2.3",
"description": "Promise-based Apple iTunes Connect Reporter",
"main": "dist/index.js",
"files": [
Expand Down