-
Notifications
You must be signed in to change notification settings - Fork 48
Bug: NextAuth signIn and signOut functions not working #17
Comments
Ok, can this be assigned to me? Thanks. |
Hey @KyleTryon the button component in <button
+ {...props}
className={styles}
aria-label={props.ariaLabel || props.title}
title={props.title}
>
{props.children}
</button> After that the button will redirect you to [next-auth][warn][NO_SECRET]
https://next-auth.js.org/warnings#no_secret
[next-auth][warn][TWITTER_OAUTH_2_BETA]
https://next-auth.js.org/warnings#twitter_oauth_2_beta
[next-auth][error][SIGNIN_OAUTH_ERROR]
https://next-auth.js.org/errors#signin_oauth_error "ikm" must be at least one byte in length {
error: {
message: '"ikm" must be at least one byte in length',
stack: 'TypeError: "ikm" must be at least one byte in length\n' +
' at normalizeIkm (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/@panva/hkdf/dist/node/cjs/index.js:26:15)\n' +
' at hkdf (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/@panva/hkdf/dist/node/cjs/index.js:47:60)\n' +
' at getDerivedEncryptionKey (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/next-auth/jwt/index.js:114:34)\n' +
' at Object.encode (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/next-auth/jwt/index.js:48:34)\n' +
' at createState (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/next-auth/core/lib/oauth/state-handler.js:29:34)\n' +
' at getAuthorizationUrl (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/next-auth/core/lib/oauth/authorization-url.js:68:53)\n' +
' at runMicrotasks (<anonymous>)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
' at async Object.signin (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/next-auth/core/routes/signin.js:37:24)\n' +
' at async NextAuthHandler (/home/takanome_dev/Projects/OpenSource/TechSquidTV/Shoutify/node_modules/next-auth/core/index.js:238:26)',
name: 'TypeError'
},
providerId: 'twitter',
message: '"ikm" must be at least one byte in length'
} After I added a value for
|
I forgot to mention that you should probably add process in front of env in providers: [
TwitterProvider({
- clientId: env.TWITTER_CLIENT_ID as string,
- clientSecret: env.TWITTER_CLIENT_SECRET as string,
+ clientId: process.env.TWITTER_CLIENT_ID as string,
+ clientSecret: process.env.TWITTER_CLIENT_SECRET as string,
version: '2.0',
}),
], |
env in this case is a wrapper library that adds type safey |
Is there an existing issue for this?
Current behavior
It is currently possible to log in via Twitter and obtain a valid session by authenticating at this URL: http://localhost:3000/api/auth/signin.
There is a provided set of functions from NextAuth signIn/signOut
Within the current home page navigation, is a
Sign in
andSign Out
button which will show respectively depending on the truthiness of your session:https://github.com/TechSquidTV/Shoutify/blob/main/src/pages/index.tsx#L60
Shoutify/src/pages/index.tsx
Lines 60 to 74 in 997a2ed
However, currently, the
onClick
functions which should trigger thesignIn
andsignOut
functions to not appear to be working. There are no errors in server logs or browser console.Steps to reproduce
If you have not yet signed in, you will see this:
If you do have a session, you will see this:
Attempt to click either of the
Sign In
orSign Out
buttons, and you should see no change in the page.Expected behavior
According to the NextAuth signIn docs, the user should be redirected to an authentication flow.
Shoutify app version
No response
Node.js version
No response
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: