Skip to content

Commit

Permalink
Merge pull request #110 from canjs/89-decorate-auth-response
Browse files Browse the repository at this point in the history
Return full response object after authentication
  • Loading branch information
chasenlehara authored May 27, 2018
2 parents 8f5e79b + 27b3f49 commit 1ecf653
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion session/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ module.exports = connect.behavior('data/feathers-session', function (base) {
var requestData = convertLocalAuthData(data);
return feathersClient.authenticate(requestData)
.then(function (response) {
return response.accessToken ? decode(response.accessToken) : response;
if (response.accessToken) {
Object.assign(response, decode(response.accessToken));
}
return response;
});
},
getData: function () {
Expand Down
1 change: 1 addition & 0 deletions session/session_tests-x-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ module.exports = function runSessionTests (options) {
session.save()
.then(function (res) {
assert.ok(res._id, 'Got session data back');
assert.ok(res.accessToken, 'Got full response data back');
Session.get()
.then(function (res) {
assert.ok(res._id, 'Session.get returned session data');
Expand Down

0 comments on commit 1ecf653

Please sign in to comment.