28 lines
650 B
Vue
28 lines
650 B
Vue
<template>
|
|
<div>这是callback页面 {{ token }}</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { useAuth0 } from '@auth0/auth0-vue';
|
|
import { useMessage } from 'naive-ui';
|
|
const { getAccessTokenSilently } = useAuth0();
|
|
const token = ref('');
|
|
const router = useRouter();
|
|
const message = useMessage();
|
|
const oSomethingWithToken = async () => {
|
|
try {
|
|
token.value = await getAccessTokenSilently();
|
|
message.success('登录成功!');
|
|
router.push('/layout');
|
|
}catch(error){
|
|
router.push('/');
|
|
message.error('错误!');
|
|
}
|
|
|
|
}
|
|
onMounted(()=>{
|
|
oSomethingWithToken();
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss" scoped></style> |