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",
"vue": "^3.2.25",
"vue-router": "^4.0.14",
"vuetify": "3.0.0-beta.0"
"vuetify": "3.0.0-beta.0",
"@auth0/auth0-vue": "^1.0.0"
},
"devDependencies": {
"@braks/revue-draggable": "^0.4.2",

View File

@ -1,6 +1,7 @@
lockfileVersion: 5.3
specifiers:
'@auth0/auth0-vue': ^1.0.0
'@braks/revue-draggable': ^0.4.2
'@typescript-eslint/eslint-plugin': ^5.18.0
'@typescript-eslint/parser': ^5.18.0
@ -17,6 +18,7 @@ specifiers:
vuetify: 3.0.0-beta.0
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
install: 0.13.0
vue: 3.2.31
@ -36,6 +38,31 @@ devDependencies:
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:
resolution: {integrity: sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==}
engines: {node: '>=6.9.0'}
@ -722,6 +749,10 @@ packages:
vue-demi: 0.12.5_vue@3.2.31
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:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies:
@ -874,6 +905,13 @@ packages:
fill-range: 7.0.1
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:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
dev: true
@ -1052,6 +1090,11 @@ packages:
'@babel/types': 7.17.0
dev: true
/core-js/3.21.1:
resolution: {integrity: sha512-FRq5b/VMrWlrmCzwRrpDYNxyHP9BcAZC+xHJaqTgIE5091ZV1NTmyh0sGOg5XqpnHvR0svdy0sv1gWA1zmhxig==}
requiresBuild: true
dev: false
/core-util-is/1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: true
@ -1254,6 +1297,10 @@ packages:
is-arrayish: 0.2.1
dev: true
/es-cookie/1.3.2:
resolution: {integrity: sha512-UTlYYhXGLOy05P/vKVT2Ui7WtC7NiRzGtJyAKKn32g5Gvcjn7KAClLPWlipCtxIus934dFg9o9jXiBL0nP+t9Q==}
dev: false
/esbuild-android-64/0.14.34:
resolution: {integrity: sha512-XfxcfJqmMYsT/LXqrptzFxmaR3GWzXHDLdFNIhm6S00zPaQF1TBBWm+9t0RZ6LRR7iwH57DPjaOeW20vMqI4Yw==}
engines: {node: '>=12'}
@ -1639,6 +1686,10 @@ packages:
resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=}
dev: true
/fast-text-encoding/1.0.3:
resolution: {integrity: sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==}
dev: false
/fastq/1.13.0:
resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==}
dependencies:
@ -2280,6 +2331,10 @@ packages:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
dev: true
/lodash/4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: false
/loud-rejection/1.6.0:
resolution: {integrity: sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=}
engines: {node: '>=0.10.0'}
@ -2678,6 +2733,10 @@ packages:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
dev: true
/promise-polyfill/8.2.3:
resolution: {integrity: sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg==}
dev: false
/promise/7.3.1:
resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==}
dependencies:
@ -3339,6 +3398,10 @@ packages:
hasBin: true
dev: true
/unfetch/4.2.0:
resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==}
dev: false
/unified-engine/6.0.1:
resolution: {integrity: sha512-iDJYH82TgcezQA4IZzhCNJQx7vBsGk4h9s4Q7Fscrb3qcPsxBqVrVNYez2W3sBVTxuU1bFAhyRpA6ba/R4j93A==}
dependencies:

View File

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

View File

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