how do I force logout after password reset from th...
# ask-a-descoper
a
how do I force logout after password reset from the profile widget using vuejs
āœ… 1
d
Using the onLogout Callback Use the
onLogout
callback prop on the UserProfile widget to handle logout events, including after password resets.
Copy code
<template>
  <UserProfile
    widgetId="user-profile-widget"
    :onLogout="handleLogout"
  />
</template>
<script setup>
import { UserProfile } from '@descope/vue-sdk'
import { useDescope } from '@descope/vue-sdk'
import { useRouter } from 'vue-router'
const { logout } = useDescope()
const router = useRouter()
const handleLogout = async () => {
  await logout()
  router.push('/login')
}
</script>
Alternative Approach You can also use the SDK's logout function directly and redirect programmatically:
Copy code
<script setup>
import { useDescope } from '@descope/vue-sdk'
const { logout } = useDescope()
const forceLogout = async () => {
  await logout()
  window.location.href = '/login'
}
</script>
• The
onLogout
callback fires when users log out from the profile widget • Use
useDescope().logout()
to programmatically log out users User Widgets | Descope Documentation Vue.js &amp; Ruby Quickstart | Descope Documentation
šŸ‘ 1