Skip to content

Commit 73e1c8e

Browse files
committed
using both revocable and legacy auth tokens, need tests
1 parent b736715 commit 73e1c8e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Auth.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ var getAuthForSessionToken = function({ config, sessionToken, installationId } =
5353
include: 'user'
5454
};
5555

56-
if(config.legacySessionTokens) {
56+
// if(config.legacySessionTokens) {
57+
function attemptLegacySessionTokens() {
5758
var query = new RestQuery(config, master(config), '_User', { sessionToken }, restOptions);
5859
return query.execute().then((response) => {
5960
var results = response.results;
@@ -69,12 +70,15 @@ var getAuthForSessionToken = function({ config, sessionToken, installationId } =
6970
cache.users.set(sessionToken, userObject);
7071
return new Auth({ config, isMaster: false, installationId, user: userObject });
7172
});
72-
} else {
73+
// } else {
74+
}
75+
7376
var query = new RestQuery(config, master(config), '_Session', { sessionToken }, restOptions);
7477
return query.execute().then((response) => {
7578
var results = response.results;
7679
if (results.length !== 1 || !results[0]['user']) {
77-
return nobody(config);
80+
// return nobody(config);
81+
return attemptLegaySessionTokens()
7882
}
7983

8084
var now = new Date(),
@@ -91,7 +95,6 @@ var getAuthForSessionToken = function({ config, sessionToken, installationId } =
9195
cache.users.set(sessionToken, userObject);
9296
return new Auth({ config, isMaster: false, installationId, user: userObject });
9397
});
94-
}
9598
};
9699

97100
// Returns a promise that resolves to an array of role names

0 commit comments

Comments
 (0)