Auth0 login fails with "TypeError: "secret" is required"
See original GitHub issueDescription
I have followed the Auth0 for Next.js instructions. This is not working locally either.
TypeError: "secret" is required
at Object.get (/app/node_modules/@auth0/nextjs-auth0/dist/auth0-session/get-config.js:147:15)
at Object.getConfig (/app/node_modules/@auth0/nextjs-auth0/dist/config.js:66:38)
at Object.initAuth0 (/app/node_modules/@auth0/nextjs-auth0/dist/index.js:22:23)
at getInstance (/app/node_modules/@auth0/nextjs-auth0/dist/index.js:18:24)
at getSession (/app/node_modules/@auth0/nextjs-auth0/dist/index.js:60:18)
at Object.<anonymous> (/app/node_modules/@auth0/nextjs-auth0/dist/helpers/with-page-auth-required.js:23:35)
at step (/app/node_modules/tslib/tslib.js:143:27)
at Object.next (/app/node_modules/tslib/tslib.js:124:57)
at /app/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
Reproduction
export default initAuth0({
clientID: authCid,
clientSecret: 'val',
secret: 'val',
baseURL: 'val',
issuerBaseURL: 'val',
httpTimeout: 'val',
authorizationParams: {
response_type: 'code',
scope: 'val'
},
session: {
name: 'val',
rollingDuration: 'val'
}
});
import auth0 from '../../../lib/auth0';
export default auth0.handleAuth();
I am creating my own instance by passing values manually. I am not setting any environment variable are AUTH0_SECRET, and AUTH0_CLIENT_SECRET are required even if I use to create an instance
"@auth0/nextjs-auth0": "1.6.1",
"next": "11.1.2",
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Auth0 login fails with '"secret" is required' when deployed to ...
For the auth/api/me and auth/api/login routes I get the TypeError: "secret" is required . my config: const { PHASE_DEVELOPMENT_SERVER } = ...
Read more >TypeError: "secret" is required next.js - Auth0 Community
i follow this tutorial https://auth0.com/docs/quickstart/webapp/nextjs/01-login But i get back this error This is the error i get:
Read more >TypeError: "secret" is required - node.js - Stack Overflow
I encountered the exact same issue when developing my own app with Auth0. The solution is to require dotenv before you require your...
Read more >BaseConfig | @auth0/nextjs-auth0
Function that returns an object with URL-safe state values for login. Used for passing custom state parameters to your authorization server. Can also...
Read more >How to add Auth0 to Nextjs- the Ultimate Guide | Code Mochi
Hi, For some reason, I am getting TypeError: "secret" is required during initAuth0. The .env variables are printed correctly... Can't figure ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @sajid-dev
If you initialize your own instance of the SDK with
initAuth0
- you need to use the server methods from that instance. egYou can’t mix instance methods and named exports (when you use named exports, we create an instance for you using your environment variables) - see https://auth0.github.io/nextjs-auth0/modules/config.html#2-create-your-own-instance-using-initauth0 for more info
It works now thanks a lot for taking your time and finding my mistake