Skip to content

Commit

Permalink
force cookie resetting, including backup cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed Sep 18, 2024
1 parent 7367997 commit ef59114
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 10 additions & 2 deletions kbase-extension/static/kbase/js/api/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
define(['bluebird', 'jquery', 'narrativeConfig'], (Promise, $, Config) => {
'use strict';

function factory(config) {
const url = config.url;
const secureCookies =
Expand Down Expand Up @@ -277,6 +275,16 @@ define(['bluebird', 'jquery', 'narrativeConfig'], (Promise, $, Config) => {
return [url, '/api/', version, callParams.operation].join('');
})();

// const options = {
// method: callParams.method,
// headers: {
// Authorization: token,
// 'Content-Type': 'application/json',
// },

// }
// return fetch(callString, options);

return Promise.resolve(
$.ajax({
url: callString,
Expand Down
8 changes: 3 additions & 5 deletions kbase-extension/static/kbase/js/narrativeLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ define([
'userMenu',
'util/bootstrapDialog',
], ($, Promise, kbapi, JupyterUtils, Config, Auth, UserMenu, BootstrapDialog) => {
'use strict';
const baseUrl = JupyterUtils.get_body_data('baseUrl');
const authClient = Auth.make({ url: Config.url('auth') });
let sessionInfo = null;
Expand Down Expand Up @@ -98,10 +97,8 @@ define([
function showNotLoggedInDialog() {
const message = `
<p>You are logged out (or your session has expired).</p>
<p>You will be redirected to the sign in page after closing this, or ${
AUTO_LOGOUT_DELAY / 1000
} seconds,
whichever comes first.</p>
<p>You will be redirected to the sign in page after closing this, or
${AUTO_LOGOUT_DELAY / 1000} seconds, whichever comes first.</p>
`;
const dialog = new BootstrapDialog({
title: 'Logged Out',
Expand Down Expand Up @@ -309,6 +306,7 @@ define([
authClient.getUserProfile(sessionToken),
])
.then(([tokenInfo, accountInfo]) => {
authClient.setAuthToken(sessionToken);
sessionInfo = tokenInfo;
this.sessionInfo = tokenInfo;
this.accountInfo = accountInfo;
Expand Down

0 comments on commit ef59114

Please sign in to comment.