Skip to content

Commit

Permalink
fix: omit cookies by default (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongranick-okta authored Mar 27, 2020
1 parent c08bb3a commit ff995e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/okta-auth-js/lib/fetch/fetchRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function fetchRequest(method, url, args) {
method: method,
headers: args.headers,
body: body,
credentials: args.withCredentials === false ? 'omit' : 'include'
credentials: args.withCredentials ? 'include' : 'omit'
})
.then(function(response) {
var error = !response.ok;
Expand Down
10 changes: 5 additions & 5 deletions packages/okta-auth-js/test/spec/fetch-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('fetchRequest', function () {
method: requestMethod,
headers: requestHeaders,
body: JSON.stringify(requestJSON),
credentials: 'include'
credentials: 'omit'
});
});
});
Expand All @@ -80,20 +80,20 @@ describe('fetchRequest', function () {
method: requestMethod,
headers: requestHeaders,
body: requestText,
credentials: 'include'
credentials: 'omit'
});
});
});


it('Can omit credentials', function() {
it('Can include credentials', function() {
return fetchRequest(requestMethod, requestUrl, {
withCredentials: false
withCredentials: true
})
.then(() => {
expect(fetchSpy).toHaveBeenCalledWith(requestUrl, {
method: requestMethod,
credentials: 'omit'
credentials: 'include'
});
});
});
Expand Down

0 comments on commit ff995e5

Please sign in to comment.