Add Auth0

This commit is contained in:
QiTao Weng 2022-04-09 02:02:30 -05:00
parent 902e51f099
commit 17dedd2d37
7 changed files with 112 additions and 68 deletions

View File

@ -15,7 +15,8 @@
"install": "^0.13.0", "install": "^0.13.0",
"vue": "^3.2.25", "vue": "^3.2.25",
"vue-router": "^4.0.14", "vue-router": "^4.0.14",
"vuetify": "3.0.0-beta.0" "vuetify": "3.0.0-beta.0",
"@auth0/auth0-vue": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@braks/revue-draggable": "^0.4.2", "@braks/revue-draggable": "^0.4.2",

View File

@ -1,6 +1,7 @@
lockfileVersion: 5.3 lockfileVersion: 5.3
specifiers: specifiers:
'@auth0/auth0-vue': ^1.0.0
'@braks/revue-draggable': ^0.4.2 '@braks/revue-draggable': ^0.4.2
'@typescript-eslint/eslint-plugin': ^5.18.0 '@typescript-eslint/eslint-plugin': ^5.18.0
'@typescript-eslint/parser': ^5.18.0 '@typescript-eslint/parser': ^5.18.0
@ -17,6 +18,7 @@ specifiers:
vuetify: 3.0.0-beta.0 vuetify: 3.0.0-beta.0
dependencies: dependencies:
'@auth0/auth0-vue': 1.0.0_vue-router@4.0.14
'@vuetify/vite-plugin': 1.0.0-alpha.10_vite@2.9.1+vuetify@3.0.0-beta.0 '@vuetify/vite-plugin': 1.0.0-alpha.10_vite@2.9.1+vuetify@3.0.0-beta.0
install: 0.13.0 install: 0.13.0
vue: 3.2.31 vue: 3.2.31
@ -36,6 +38,31 @@ devDependencies:
packages: packages:
/@auth0/auth0-spa-js/1.21.0:
resolution: {integrity: sha512-a+8+onJdOIUSEEjdIzP/BGd731DZjBn2Q0tH+v7H+bN9ldeuBOifnjPbFwQAriL+94SwkaqhoFx3L6uGDk3+vg==}
dependencies:
abortcontroller-polyfill: 1.7.3
browser-tabs-lock: 1.2.15
core-js: 3.21.1
es-cookie: 1.3.2
fast-text-encoding: 1.0.3
promise-polyfill: 8.2.3
unfetch: 4.2.0
dev: false
/@auth0/auth0-vue/1.0.0_vue-router@4.0.14:
resolution: {integrity: sha512-RYmJPq77fn2PjvfgwThpjwj3gZLtbkpVQMH/1+egc+2z+TpAOINF6XzHq0kOD4MwPXAuCqnainMhhKhMvCCSFw==}
peerDependencies:
vue-router: ^4.0.12
peerDependenciesMeta:
vue-router:
optional: true
dependencies:
'@auth0/auth0-spa-js': 1.21.0
vue: 3.2.31
vue-router: 4.0.14_vue@3.2.31
dev: false
/@babel/code-frame/7.16.7: /@babel/code-frame/7.16.7:
resolution: {integrity: sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==} resolution: {integrity: sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
@ -722,6 +749,10 @@ packages:
vue-demi: 0.12.5_vue@3.2.31 vue-demi: 0.12.5_vue@3.2.31
dev: true dev: true
/abortcontroller-polyfill/1.7.3:
resolution: {integrity: sha512-zetDJxd89y3X99Kvo4qFx8GKlt6GsvN3UcRZHwU6iFA/0KiOmhkTVhe8oRoTBiTVPZu09x3vCra47+w8Yz1+2Q==}
dev: false
/acorn-jsx/5.3.2_acorn@8.7.0: /acorn-jsx/5.3.2_acorn@8.7.0:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies: peerDependencies:
@ -874,6 +905,13 @@ packages:
fill-range: 7.0.1 fill-range: 7.0.1
dev: true dev: true
/browser-tabs-lock/1.2.15:
resolution: {integrity: sha512-J8K9vdivK0Di+b8SBdE7EZxDr88TnATing7XoLw6+nFkXMQ6sVBh92K3NQvZlZU91AIkFRi0w3sztk5Z+vsswA==}
requiresBuild: true
dependencies:
lodash: 4.17.21
dev: false
/buffer-from/1.1.2: /buffer-from/1.1.2:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
dev: true dev: true
@ -1052,6 +1090,11 @@ packages:
'@babel/types': 7.17.0 '@babel/types': 7.17.0
dev: true dev: true
/core-js/3.21.1:
resolution: {integrity: sha512-FRq5b/VMrWlrmCzwRrpDYNxyHP9BcAZC+xHJaqTgIE5091ZV1NTmyh0sGOg5XqpnHvR0svdy0sv1gWA1zmhxig==}
requiresBuild: true
dev: false
/core-util-is/1.0.3: /core-util-is/1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: true dev: true
@ -1254,6 +1297,10 @@ packages:
is-arrayish: 0.2.1 is-arrayish: 0.2.1
dev: true dev: true
/es-cookie/1.3.2:
resolution: {integrity: sha512-UTlYYhXGLOy05P/vKVT2Ui7WtC7NiRzGtJyAKKn32g5Gvcjn7KAClLPWlipCtxIus934dFg9o9jXiBL0nP+t9Q==}
dev: false
/esbuild-android-64/0.14.34: /esbuild-android-64/0.14.34:
resolution: {integrity: sha512-XfxcfJqmMYsT/LXqrptzFxmaR3GWzXHDLdFNIhm6S00zPaQF1TBBWm+9t0RZ6LRR7iwH57DPjaOeW20vMqI4Yw==} resolution: {integrity: sha512-XfxcfJqmMYsT/LXqrptzFxmaR3GWzXHDLdFNIhm6S00zPaQF1TBBWm+9t0RZ6LRR7iwH57DPjaOeW20vMqI4Yw==}
engines: {node: '>=12'} engines: {node: '>=12'}
@ -1639,6 +1686,10 @@ packages:
resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=} resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=}
dev: true dev: true
/fast-text-encoding/1.0.3:
resolution: {integrity: sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==}
dev: false
/fastq/1.13.0: /fastq/1.13.0:
resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==}
dependencies: dependencies:
@ -2280,6 +2331,10 @@ packages:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
dev: true dev: true
/lodash/4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: false
/loud-rejection/1.6.0: /loud-rejection/1.6.0:
resolution: {integrity: sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=} resolution: {integrity: sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -2678,6 +2733,10 @@ packages:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
dev: true dev: true
/promise-polyfill/8.2.3:
resolution: {integrity: sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg==}
dev: false
/promise/7.3.1: /promise/7.3.1:
resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==} resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==}
dependencies: dependencies:
@ -3339,6 +3398,10 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/unfetch/4.2.0:
resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==}
dev: false
/unified-engine/6.0.1: /unified-engine/6.0.1:
resolution: {integrity: sha512-iDJYH82TgcezQA4IZzhCNJQx7vBsGk4h9s4Q7Fscrb3qcPsxBqVrVNYez2W3sBVTxuU1bFAhyRpA6ba/R4j93A==} resolution: {integrity: sha512-iDJYH82TgcezQA4IZzhCNJQx7vBsGk4h9s4Q7Fscrb3qcPsxBqVrVNYez2W3sBVTxuU1bFAhyRpA6ba/R4j93A==}
dependencies: dependencies:

View File

@ -1,20 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs import Home from './components/Home.vue'
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import HelloWorld from './components/HelloWorld.vue'
</script> </script>
<template> <template>
<div id = "sidebar"> <img alt="Vue logo" src="./assets/logo.png" />
<Home msg="CrystalMathy" />
</div>
<div id = "main">
<img alt="Vue logo" src="./assets/logo.png" />
<git msg="Hello Vue 3 + TypeScript + Vite" />
</div>
</template> </template>
<style> <style>

View File

@ -1,52 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
defineProps<{ msg: string }>()
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<p>
Recommended IDE setup:
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
</p>
<p>See <code>README.md</code> for more information.</p>
<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Docs
</a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
</p>
<button type="button" @click="count++">count is: {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
</template>
<style scoped>
a {
color: #42b983;
}
label {
margin: 0 0.5em;
font-weight: bold;
}
code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px;
color: #304455;
}
</style>

33
src/components/Home.vue Normal file
View File

@ -0,0 +1,33 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useAuth0 } from '@auth0/auth0-vue';
defineProps<{ msg: string }>()
const { loginWithRedirect } = useAuth0();
const login = () => {
loginWithRedirect();
}
</script>
<template>
<h1>{{ msg }}</h1>
<button @click="login">Log in</button>
</template>
<style scoped>
button {
background-color: #215b8a; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 32px;
border-radius: 5px;
}
</style>

View File

@ -1,9 +1,18 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import Draggable, { DraggablePlugin, DraggableDirective } from '@braks/revue-draggable' import { DraggablePlugin } from '@braks/revue-draggable'
import { createAuth0 } from '@auth0/auth0-vue'
const app = createApp(App) const app = createApp(App)
app.use(
createAuth0({
domain: 'dev-ge84r-eu.us.auth0.com',
client_id: 'zHjZGg1uPws0DkQg5bRdKcDX8m6AuTZl', // eslint-disable-line camelcase
redirect_uri: window.location.origin, // eslint-disable-line camelcase
}),
)
app.use(DraggablePlugin) app.use(DraggablePlugin)
app.mount('#app') app.mount('#app')

View File

@ -1,6 +1,6 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import vuetify from '@vuetify/vite-plugin'; import vuetify from '@vuetify/vite-plugin'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({