Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: "secret" does not match any of the allowed types #4

Closed
arnonrdp opened this issue Jul 20, 2021 · 5 comments
Closed

TypeError: "secret" does not match any of the allowed types #4

arnonrdp opened this issue Jul 20, 2021 · 5 comments

Comments

@arnonrdp
Copy link

Hi, I just used you project as a template, followed step-by-step and after running yarn dev it displays the main page as it should.

But when I click login it returns Internal Server Error and console.log shows it:

TypeError: "secret" does not match any of the allowed types
    at Object.get (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/auth0-session/get-config.js:145:15)
    at Object.getConfig (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/config.js:65:40)
    at Object.initAuth0 (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/index.js:22:49)
    at getInstance (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/index.js:18:24)
    at handleAuth (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/index.js:69:33)
    at eval (webpack-internal:https:///./src/pages/api/auth/[...auth0].ts:25:127)
    at Object../src/pages/api/auth/[...auth0].ts (/Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/pages/api/auth/[...auth0].js:44:1)
    at __webpack_require__ (/Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/webpack-runtime.js:33:42)
    at __webpack_exec__ (/Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/pages/api/auth/[...auth0].js:76:52)
    at /Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/pages/api/auth/[...auth0].js:77:28

Here is what I did:

  • I renamed the file .env.local.template to .env.local;
  • On fauna.com I created a new DB, went to security and generate a new Secret Key;
  • I inserted this secret key in .env.local right on FAUNADB_SECRET_KEY;
  • I inserted the name of the database in line 3 of newuser.js.

After running yarn setup:db it created the users collection and user_by_id index.
I really don't know what I missed. Do you know what it could be?

@tbdsux
Copy link
Owner

tbdsux commented Jul 20, 2021

Hi, I just used you project as a template, followed step-by-step and after running yarn dev it displays the main page as it should.

But when I click login it returns Internal Server Error and console.log shows it:

TypeError: "secret" does not match any of the allowed types
    at Object.get (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/auth0-session/get-config.js:145:15)
    at Object.getConfig (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/config.js:65:40)
    at Object.initAuth0 (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/index.js:22:49)
    at getInstance (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/index.js:18:24)
    at handleAuth (/Users/arnon/Sites/GitHub/virtual-bookshelf/node_modules/@auth0/nextjs-auth0/dist/index.js:69:33)
    at eval (webpack-internal:https:///./src/pages/api/auth/[...auth0].ts:25:127)
    at Object../src/pages/api/auth/[...auth0].ts (/Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/pages/api/auth/[...auth0].js:44:1)
    at __webpack_require__ (/Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/webpack-runtime.js:33:42)
    at __webpack_exec__ (/Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/pages/api/auth/[...auth0].js:76:52)
    at /Users/arnon/Sites/GitHub/virtual-bookshelf/.next/server/pages/api/auth/[...auth0].js:77:28

Here is what I did:

* I renamed the file `.env.local.template` to `.env.local`;

* On fauna.com I created a new DB, went to security and generate a new Secret Key;

* I inserted this secret key in `.env.local` right on `FAUNADB_SECRET_KEY`;

* I inserted the name of the database in line 3 of `newuser.js`.

After running yarn setup:db it created the users collection and user_by_id index.
I really don't know what I missed. Do you know what it could be?

Did you fill everything in your .env.local?
The error is caused by missing value of AUTH0_SECRET in the .env.local, you should generate a random secret key or code for the application to use.

@arnonrdp
Copy link
Author

I got it! It works but how do I fill these:

AUTH0_BASE_URL=
AUTH0_ISSUER_BASE_URL=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=

Do I have to deploy first?

@tbdsux
Copy link
Owner

tbdsux commented Jul 20, 2021

You have to create an Auth0 app for this one.

This guide will help you: https://auth0.com/docs/quickstart/webapp/nextjs/01-login

Sorry, I did not include a tutorial for this one.

@tbdsux
Copy link
Owner

tbdsux commented Jul 20, 2021

Routes are already configured, but you can check them and modify them at your needs.

@arnonrdp
Copy link
Author

I really appreciate!

Everything worked after this complementing guide.

By the way, thanks for sharing this template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants