Skip to content

Commit

Permalink
Merge pull request #259 from auth0/fix-cookies-cors
Browse files Browse the repository at this point in the history
Fix cookies cors
  • Loading branch information
glena authored Dec 7, 2016
2 parents a57abde + ab0e916 commit e4af5b0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/authentication/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Authentication.prototype.getSSOData = function (withActiveDirectories, cb) {

return this.request
.get(url)
.withCredentials()
.end(responseHandler(cb));
};

Expand Down
5 changes: 5 additions & 0 deletions src/helper/request-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ RequestObj.prototype.send = function (body) {
return this;
};

RequestObj.prototype.withCredentials = function () {
this.request = this.request.withCredentials();
return this;
};

RequestObj.prototype.end = function (cb) {
this.request = this.request.end(cb);
return new RequestWrapper(this.request);
Expand Down
1 change: 1 addition & 0 deletions test/helper/request-builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ describe('helpers requestBuilder', function () {
var req = new RequestBuilder({})
var handler = req
.get('https://test.com')
.withCredentials()
.end(function(err, data) {

});
Expand Down
4 changes: 4 additions & 0 deletions test/mock/request-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ RequestMock.prototype.set = function (key, value) {
RequestMock.prototype.abort = function () {
};

RequestMock.prototype.withCredentials = function () {
return this;
};

RequestMock.prototype.end = function (cb) {
expect(this.options.headers).to.eql({});
this.options.cb(cb);
Expand Down

0 comments on commit e4af5b0

Please sign in to comment.