Skip to content

Commit ac853be

Browse files
committed
upgrade to @nuxtjs/auth-next v5 + dependency updates
Provide a working example for the recommended version v5 🔥 Check https://auth.nuxtjs.org/providers/auth0
1 parent 765b858 commit ac853be

File tree

5 files changed

+2080
-1815
lines changed

5 files changed

+2080
-1815
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
AUTH0_CLIENT_ID=""
22
AUTH0_DOMAIN=""
3+
AUTH0_AUDIENCE=""

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ You can access a simple demo here: https://auth0.nuxtjs.org
88

99
## Setup
1010

11-
* Create an account at Auth0 (https://auth0.com)
12-
* Add your endpoints to your client's allowed urls like this ![nuxt-callbacks](https://cloud.githubusercontent.com/assets/904724/22703633/23f35724-ed65-11e6-83e4-227ad77c00ff.png)
13-
* Add your logout endpoint to your account allowed urls like this ![nuxt-logout-cb](https://cloud.githubusercontent.com/assets/904724/22703768/9782bbbc-ed65-11e6-93b7-9c1e4d5d7984.png)
11+
- Create an account at Auth0 (https://auth0.com)
12+
- Add your endpoints to your client's allowed urls like this ![nuxt-callbacks](https://cloud.githubusercontent.com/assets/904724/22703633/23f35724-ed65-11e6-83e4-227ad77c00ff.png)
13+
- Add your logout endpoint to your account allowed urls like this ![nuxt-logout-cb](https://cloud.githubusercontent.com/assets/904724/22703768/9782bbbc-ed65-11e6-93b7-9c1e4d5d7984.png)
1414

15-
* Copy the file `.env.example` at the root folder, rename it as `.env` and add your Auth0 keys
15+
- Copy the file `.env.example` at the root folder, rename it as `.env` and add your Auth0 keys
16+
- Find the audience value at https://manage.auth0.com/#/apis
1617

1718
## Running Locally
1819

@@ -22,4 +23,3 @@ cd example-auth0
2223
npm install
2324
npm run dev
2425
```
25-

nuxt.config.js

+25-24
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
1-
import 'dotenv/config'
1+
import "dotenv/config";
22

33
export default {
44
/*
5-
** Headers of the page
6-
*/
5+
** Headers of the page
6+
*/
77
head: {
8-
title: 'Nuxt.js + Auth0',
8+
title: "Nuxt.js + Auth0",
99
meta: [
10-
{ charset: 'utf-8' },
11-
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
12-
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
10+
{ charset: "utf-8" },
11+
{ name: "viewport", content: "width=device-width, initial-scale=1" },
12+
{ hid: "description", name: "description", content: "Nuxt.js project" }
1313
],
1414
link: [
15-
{ rel: 'icon', type: 'image/x-icon', href: 'https://nuxtjs.org/favicon.ico' }
15+
{
16+
rel: "icon",
17+
type: "image/x-icon",
18+
href: "https://nuxtjs.org/favicon.ico"
19+
}
1620
]
1721
},
1822
/*
19-
** Global CSS
20-
*/
21-
css: [
22-
'normalize.css',
23-
'@/assets/main.css'
24-
],
23+
** Global CSS
24+
*/
25+
css: ["normalize.css", "@/assets/main.css"],
2526
/*
26-
** Modules
27-
*/
27+
** Modules
28+
*/
2829
modules: [
2930
// axios is required by @nuxtjs/auth
30-
'@nuxtjs/axios',
31+
"@nuxtjs/axios",
3132
// https://auth.nuxtjs.org
32-
'@nuxtjs/auth'
33+
"@nuxtjs/auth-next"
3334
],
3435
auth: {
3536
redirect: {
36-
login: '/', // redirect user when not connected
37-
callback: '/auth/signed-in'
37+
login: "/", // redirect user when not connected
38+
callback: "/auth/signed-in"
3839
},
3940
strategies: {
40-
local: false,
4141
auth0: {
4242
domain: process.env.AUTH0_DOMAIN,
43-
client_id: process.env.AUTH0_CLIENT_ID
43+
clientId: process.env.AUTH0_CLIENT_ID,
44+
audience: process.env.AUTH0_AUDIENCE
4445
}
4546
}
4647
},
4748
build: {
4849
// For stormkit.io
49-
publicPath: process.env.PUBLIC_PATH,
50+
publicPath: process.env.PUBLIC_PATH
5051
}
51-
}
52+
};

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
"start": "nuxt-start"
1111
},
1212
"dependencies": {
13-
"@nuxtjs/auth": "^4.9.1",
14-
"@nuxtjs/axios": "^5.12.2",
15-
"dotenv": "^8.2.0",
13+
"@nuxtjs/auth-next": "^5.0.0-1622918202.e815752",
14+
"@nuxtjs/axios": "^5.13.6",
15+
"dotenv": "^10.0.0",
1616
"normalize.css": "^8.0.1",
17-
"nuxt-start": "^2.14.3"
17+
"nuxt-start": "^2.15.6"
1818
},
1919
"devDependencies": {
20-
"nuxt": "^2.14.3"
20+
"nuxt": "^2.15.6"
2121
}
2222
}

0 commit comments

Comments
 (0)