added restart always to service
This commit is contained in:
@@ -30,6 +30,21 @@
|
||||
<script>
|
||||
const { pb, getDisplayName } = window.Auth;
|
||||
|
||||
const GRAPH_TOKEN_KEY = 'graphAccessToken';
|
||||
const extractGraphToken = (authData) => {
|
||||
return (
|
||||
authData?.meta?.graphAccessToken ||
|
||||
authData?.meta?.graph_token ||
|
||||
authData?.meta?.graphToken ||
|
||||
authData?.meta?.accessToken ||
|
||||
authData?.meta?.access_token ||
|
||||
authData?.meta?.token ||
|
||||
authData?.meta?.rawToken ||
|
||||
authData?.meta?.authData?.access_token ||
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
const loginBtn = document.getElementById('loginBtn');
|
||||
const errorEl = document.getElementById('error');
|
||||
const userInfo = document.getElementById('userInfo');
|
||||
@@ -70,6 +85,7 @@
|
||||
|
||||
function logout() {
|
||||
pb.authStore.clear();
|
||||
localStorage.removeItem(GRAPH_TOKEN_KEY);
|
||||
loginBtn.classList.remove('hidden');
|
||||
userInfo.classList.add('hidden');
|
||||
continueBtn.classList.add('hidden');
|
||||
@@ -78,8 +94,13 @@
|
||||
}
|
||||
|
||||
function displayUserInfo(authData) {
|
||||
console.log('Auth response:', authData);
|
||||
console.log('Auth meta:', authData?.meta);
|
||||
const displayName = getDisplayName();
|
||||
const email = authData?.meta?.rawUser?.email || authData?.record?.email || pb.authStore.model?.email || 'Not available';
|
||||
const graphToken = extractGraphToken(authData);
|
||||
console.log('Extracted Graph token:', graphToken ? graphToken.substring(0, 30) + '...' : 'NOT FOUND');
|
||||
if (graphToken) localStorage.setItem(GRAPH_TOKEN_KEY, graphToken);
|
||||
showAuthedUI(displayName, email);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user