Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

zapier convert: Don't send OAuth access token when requesting access token #236

Merged
merged 2 commits into from
Feb 14, 2018
Merged
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 scaffold/convert/header.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ if (before && session) { %>const maybeIncludeAuth = (request, z, bundle) => {
<% }

if (before && oauth) { %>const maybeIncludeAuth = (request, z, bundle) => {

request.headers.Authorization = `Bearer ${bundle.authData.access_token}`;

if (bundle.authData.access_token) {
request.headers.Authorization = `Bearer ${bundle.authData.access_token}`;
}
return request;
};
<% }
Expand Down
10 changes: 6 additions & 4 deletions src/tests/utils/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,9 @@ const getSessionKey = (z, bundle) => {

return convert.getHeader(wbDef).then(string => {
string.should.eql(`const maybeIncludeAuth = (request, z, bundle) => {
request.headers.Authorization = \`Bearer \${bundle.authData.access_token}\`;

if (bundle.authData.access_token) {
request.headers.Authorization = \`Bearer \${bundle.authData.access_token}\`;
}
return request;
};
`);
Expand Down Expand Up @@ -494,8 +495,9 @@ const getSessionKey = (z, bundle) => {

return convert.getHeader(wbDef).then(string => {
string.should.eql(`const maybeIncludeAuth = (request, z, bundle) => {
request.headers.Authorization = \`Bearer \${bundle.authData.access_token}\`;

if (bundle.authData.access_token) {
request.headers.Authorization = \`Bearer \${bundle.authData.access_token}\`;
}
return request;
};
`);
Expand Down