Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTV-1913 force cookie resetting, including backup cookie #3657

Merged
merged 12 commits into from
Sep 27, 2024
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);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only vestige of jquery is that API call wrapped in a Promise, so I started replacing it with a fetch call. Then realized there's some downstream unpacking effects to manage. Then realized that was a silly exercise and wasn't solving anything useful so just put it back and stopped.

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
Loading