I am using the Vue SDK and I have the following…
createAuth0({
domain: import.meta.env.VITE_AUTH_ID,
client_id: import.meta.env.VITE_CLIENT_ID,
redirect_uri: `${window.location.origin}`,
useRefreshTokens: true,
}),
let token;
try {
token = await getAccessTokenSilently({ });
} catch (err) {
console.warn(err);
token = await getAccessTokenWithPopup({ });
}
The problem is when the top one fails then it acts as if it logged out even when the popup one succeeds. How do I avoid that?
By logout I mean it rerenders and Vue recognizes isAuthenticated
as false
const { loginWithRedirect, user, isAuthenticated } = useAuth0();
<pre v-if="isAuthenticated">
<code>{{ user }}</code>
</pre>
<pre v-else>
<button @click="login">Log in</button>
</pre>