Comments (10)
nextauthjs/next-auth#7166 (comment)
from rainbowkit.
This worked for me!
// let token = await getToken({req})
if (siwe.nonce !== (await getCsrfToken({ req: { headers: req?.headers } }))) {
return null
}
from rainbowkit.
@0xAskar Did you happen to also upgrade next-auth
? A breaking change was introduced after 4.20.1
that we're waiting on some documentation around, so if that's the case, please downgrade to 4.20.1
or below for the time being.
from rainbowkit.
If that doesn't resolve the issue, are you using the Next.js App Router or Routes after upgrading to Next 13?
from rainbowkit.
@DanielSinclair hey thanks for the response:
- my
next-auth
is"next-auth": "^4.15.0",
- After upgrading to Next 13, I haven't changed what I had previously with respect to routes. I've been using
next/router
Why do you think it may problematic because of that? Its weird that the response that hits the /api/auth/[next-auth] response is a stream which makes it not accessible for the csrf token.
from rainbowkit.
Not sure if this would resolve the issue, but you should be using NEXTAUTH_SECRET
instead of NEXT_PUBLIC_NEXTAUTH_SECRET
as Next.js will bundle public envs on the client-side
from rainbowkit.
@DanielSinclair thanks for the reply, but that didn't seem to fix it either, changing the env variable and ensuring that the versions of next-auth are good. I'm still confused as to why the "req" that is passed into the nextAuth route is a circular object, a stream. Because I think that is what's preventing the getCsrfToken function from doing its thing correctly. Does that make sense or no? I'm confused as to why its a circular object that isn't parseable by the getCsrfToken function anymore?
Here's the error in reference to trying to stringify the req (I only stringified as a test)
TypeError: Converting circular structure to JSONmmended protections disabled.
--> starting at object with constructor 'Socket'
| property 'parser' -> object with constructor 'HTTPParser'
--- property 'socket' closes the circle
at JSON.stringify (<anonymous>)
at Object.authorize (webpack-internal:///(api)/./pages/api/auth/[...nextauth].js:55:43)
at runMicrotasks (<anonymous>)
The error from the await getCsrf({req}) function is below:
https://next-auth.js.org/errors#client_fetch_error Unexpected token E in JSON at position 0 {
error: {
message: 'Unexpected token E in JSON at position 0',
stack: 'SyntaxError: Unexpected token E in JSON at position 0\n' +
' at JSON.parse (<anonymous>)\n' +
' at parseJSONFromBytes ' +
from rainbowkit.
With @rainbow-me/[email protected] (reference the Migration Guide) and the latest version of next-auth
, are you still experiencing this issue? It is possible that we need to add more consideration for the App Router. Lmk
from rainbowkit.
@DanielSinclair i can try this and see if its still a problem
from rainbowkit.
hey @Markkos89 this worked for me too. this is great, thank you so much!
from rainbowkit.
Related Issues (20)
- [bug] fail to detect an installed wallet HOT 6
- [ReferenceError: localStorage is not defined] <Whenever `coinbaseWallet` is used in custom wallet list> HOT 5
- [bug] Once the wallet is connected, it will be disconnected immediately. HOT 3
- [bug] Metamask Issue in IOS Redirection Issue after connect or Sign & Switch Network Doesnt work on mobile HOT 3
- [bug] walletConnectWallet deosn't show in the modal HOT 5
- [bug] Rainbow wallet does not sign a message in Android and iOS. HOT 2
- [bug] <`useConfig` must be used within `WagmiProvider`.> HOT 1
- [bug] <Installed wallets are showing wallets that are not in the connectors array> HOT 2
- [bug] Connect wallet modal MM connect not doing anything HOT 3
- [Fraud, False Adveriting] <Rainbow's Fraud and False Advertising> HOT 5
- [bug] Cannot connect to WalletConnect in Chrome with enabled device toolbar HOT 2
- [bug] Can't connect Rainbow or CB mobile wallets using RainbowKit QR codes HOT 3
- [bug] Bybit wallet integration not working HOT 1
- [bug] Error when using `connectorsForWallets` to create connectors object in `cookieToInitialState` by wagmi HOT 2
- [bug] Touchpad zoom and pan do not work on modals HOT 3
- [bug] process.env breaks Vite-based projects in Dev HOT 1
- [bug] Coinbase wallet QR code scan not showing prompt consistently HOT 1
- Rainbow wallet and metamask QR codes don't display when pressing their tabs [bug] HOT 4
- [bug] Invalid balance formatting shows balance in exponential format HOT 1
- [bug] sending transaction not working for OKX wallet HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rainbowkit.