Added auth0 authentication

This commit is contained in:
2020-08-01 21:45:05 +01:00
parent c2311b8564
commit 0c7000ba09
6 changed files with 87 additions and 67 deletions

View File

@@ -56,6 +56,7 @@ export default {
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/pwa',
'@nuxtjs/auth'
],
/*
** Axios module configuration
@@ -67,5 +68,17 @@ export default {
** See https://nuxtjs.org/api/configuration-build/
*/
build: {
},
router: {
middleware: ['auth']
},
auth: {
strategies: {
local: false,
auth0: {
domain: process.env.NUXT_ENV_AUTH0_DOMAIN,
client_id: process.env.NUXT_ENV_AUTH0_CLIENT_ID,
}
}
}
}

51
package-lock.json generated
View File

@@ -1465,6 +1465,11 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
"integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ=="
},
"nanoid": {
"version": "3.1.12",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz",
"integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A=="
}
}
},
@@ -1632,6 +1637,28 @@
}
}
},
"@nuxtjs/auth": {
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/auth/-/auth-4.9.1.tgz",
"integrity": "sha512-h5VZanq2+P47jq3t0EnsZv800cg/ufOPC6JqvcyeDFJM99p58jHSODAjDuePo3PrZxd8hovMk7zusU5lOHgjvQ==",
"requires": {
"@nuxtjs/axios": "^5.9.5",
"body-parser": "^1.19.0",
"consola": "^2.11.3",
"cookie": "^0.4.0",
"is-https": "^1.0.0",
"js-cookie": "^2.2.1",
"lodash": "^4.17.15",
"nanoid": "^2.1.11"
},
"dependencies": {
"nanoid": {
"version": "2.1.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz",
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
}
}
},
"@nuxtjs/axios": {
"version": "5.12.0",
"resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.12.0.tgz",
@@ -1940,6 +1967,14 @@
"@types/node": "*"
}
},
"@types/nuxtjs__auth": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/@types/nuxtjs__auth/-/nuxtjs__auth-4.8.4.tgz",
"integrity": "sha512-K7F+MS1Yd5WGnfPwRfsiTxIrT5CIZWyCb42m+E2dsrkojBgK6EmboR3sA7eVajNQMLamrNHU7PAiiOnc0rx0Yw==",
"requires": {
"vue": "^2.6.10"
}
},
"@types/optimize-css-assets-webpack-plugin": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@types/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.1.tgz",
@@ -6024,6 +6059,11 @@
"is-extglob": "^2.1.1"
}
},
"is-https": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-https/-/is-https-1.0.0.tgz",
"integrity": "sha512-1adLLwZT9XEXjzhQhZxd75uxf0l+xI9uTSFaZeSESjL3E1eXSPpO+u5RcgqtzeZ1KCaNvtEwZSTO2P4U5erVqQ=="
},
"is-nan": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.0.tgz",
@@ -6177,6 +6217,11 @@
"resolved": "https://registry.npmjs.org/jiti/-/jiti-0.1.11.tgz",
"integrity": "sha512-zSPegl+ageMLSYcq1uAZa6V56pX2GbNl/eU3Or7PFHu10a2YhLAXj5fnHJGd6cHZTalSR8zXGH8WmyuyufMhLA=="
},
"js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -6723,9 +6768,9 @@
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
},
"nanoid": {
"version": "3.1.12",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz",
"integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A=="
"version": "2.1.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz",
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
},
"nanomatch": {
"version": "1.2.13",

View File

@@ -10,8 +10,11 @@
},
"dependencies": {
"@nuxt/typescript-runtime": "^1.0.0",
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.12.0",
"@nuxtjs/pwa": "^3.0.0-beta.20",
"@types/nuxtjs__auth": "^4.8.4",
"nanoid": "^2.1.11",
"nuxt": "^2.14.0"
},
"devDependencies": {

View File

@@ -1,80 +1,19 @@
<template>
<div class="container">
<div>
<Logo />
<h1 class="title">
team-management
</h1>
<div class="links">
<a
href="https://nuxtjs.org/"
target="_blank"
rel="noopener noreferrer"
class="button--green"
>
Documentation
</a>
<a
href="https://github.com/nuxt/nuxt.js"
target="_blank"
rel="noopener noreferrer"
class="button--grey"
>
GitHub
</a>
</div>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({})
</script>
<style>
/* Sample `apply` at-rules with Tailwind CSS
.container {
@apply min-h-screen flex justify-center items-center text-center mx-auto;
}
*/
.container {
margin: 0 auto;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.title {
font-family:
'Quicksand',
'Source Sans Pro',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
'Helvetica Neue',
Arial,
sans-serif;
display: block;
font-weight: 300;
font-size: 100px;
color: #35495e;
letter-spacing: 1px;
}
.subtitle {
font-weight: 300;
font-size: 42px;
color: #526488;
word-spacing: 5px;
padding-bottom: 15px;
}
.links {
padding-top: 15px;
}
</style>

20
pages/login.vue Normal file
View File

@@ -0,0 +1,20 @@
<template>
<div>
<button @click="login"> Login/Register </button>
</div>
</template>
<script>
export default {
name: "login",
methods: {
login: function () {
this.$auth.loginWith('auth0')
}
}
}
</script>
<style scoped>
</style>

0
store/index.ts Normal file
View File