第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

關(guān)閉瀏覽器選項(xiàng)卡并再次打開頁(yè)面后,如何使用 vue-msal 從 AAD 重新獲取令牌?

關(guān)閉瀏覽器選項(xiàng)卡并再次打開頁(yè)面后,如何使用 vue-msal 從 AAD 重新獲取令牌?

慕斯王 2022-12-18 18:51:22
我有以下代碼用于通過(guò) vue-msal 連接到 Azure AD 的基于 Vue JS 的單頁(yè)應(yīng)用程序,當(dāng)我:第一次打開網(wǎng)絡(luò)應(yīng)用程序?qū)⑽規(guī)У?AAD 登錄頁(yè)面登錄后,將我重定向回我的應(yīng)用程序然后我可以做一個(gè)console.log()并打印出我的訪問(wèn)令牌等以驗(yàn)證登錄是否成功并且令牌已成功獲取現(xiàn)在假設(shè)我關(guān)閉瀏覽器選項(xiàng)卡。我的登錄會(huì)話仍然存在(畢竟,我沒(méi)有刪除任何 cookie?。┑F(xiàn)在我的訪問(wèn)令牌不見了(大概是因?yàn)樗槐4鏋樽兞慷皇?cookie 中)。當(dāng)我打開一個(gè)新選項(xiàng)卡并導(dǎo)航到我的應(yīng)用程序時(shí),如何重新獲取訪問(wèn)令牌?# main.jsimport Vue from 'vue'import App from './App.vue'import router from './router'import msal from 'vue-msal';Vue.config.productionTip = falseVue.use(msal, {  auth: {    clientId: "CLIENT_ID_OF_MY_SINGLE_PAGE_APPLICATION"    authority: "https://login.microsoftonline.com/TENANT_ID/",    redirectUri: "http://localhost:8080/",    requireAuthOnInitialize: true  },  request: {    scopes: [ `user.read`, `https://backend-api-hosted-on-functionapp.azurewebsites.net/user_impersonation` ]  },  graph: {    callAfterInit: true,  },  cache: {    cacheLocation: "sessionStorage"  }});new Vue({  router,  render: h => h(App),  data: function() {    return {      dummyVariable: 'dummyValue',    }  },  created() {    console.log("User auth status is: " + this.$msal.isAuthenticated());    console.log("User data object: " + JSON.stringify(this.$msal)) // shows the bearer token the first time, but when I then close the tab and re-open the tab, I see nothing here  }}}).$mount('#app')所以我有幾個(gè)問(wèn)題:如果再次加載應(yīng)用程序,我是否“注定要”重新獲取新令牌?這是傳統(tǒng)做法嗎?如果是這樣,我該怎么做?我嘗試使用:
查看完整描述

1 回答

?
慕森王

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超3個(gè)贊

萬(wàn)一其他人最終看到了這個(gè)問(wèn)題,這不是我的代碼本身的問(wèn)題,而是 vue-msal 和 msal 包之間持續(xù)存在的問(wèn)題,如本 GH 問(wèn)題所述:https://github .com/mvertopoulos/vue-msal/issues/33


查看完整回答
反對(duì) 回復(fù) 2022-12-18
  • 1 回答
  • 0 關(guān)注
  • 94 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)