project_next_14_ai_prompt_sharing icon indicating copy to clipboard operation
project_next_14_ai_prompt_sharing copied to clipboard

Error: [next-auth]: `useSession` must be wrapped in a <SessionProvider />

Open Abdifatah-said opened this issue 1 year ago • 7 comments

image

iam encountering this error, how should i fix it.

thank you.

Abdifatah-said avatar May 16 '23 08:05 Abdifatah-said

Hi there, did you solved this problem ?

Alxcalex avatar May 19 '23 12:05 Alxcalex

no still i didnt solve it

Abdifatah-said avatar May 19 '23 17:05 Abdifatah-said

In Provider.jsx wrap it with SessionProvider and in layout.js wrap body with Provider

YugBhanushali avatar May 21 '23 09:05 YugBhanushali

just wrap like this:

    <Provider>
      <Nav/>
      {children}
      </Provider>

Nith567 avatar Jun 06 '23 17:06 Nith567

check your RootLayout component. it's in /app/layout.jsx file

 <html lang="en">
        <body>
            <Provider>
                <div className="main">
                    <div className="gradient"></div>
                </div>
                <main className="app">
                    <Nav />
                    {children}
                </main>
            </Provider>
        </body>
    </html>

gr8guyrabi avatar Jun 13 '23 05:06 gr8guyrabi

check your RootLayout component. it's in /app/layout.jsx file

 <html lang="en">
        <body>
            <Provider>
                <div className="main">
                    <div className="gradient"></div>
                </div>
                <main className="app">
                    <Nav />
                    {children}
                </main>
            </Provider>
        </body>
    </html>

Yes This is right code

yuvraj042003 avatar Jul 11 '23 02:07 yuvraj042003

check your RootLayout component. it's in /app/layout.jsx file

 <html lang="en">
        <body>
            <Provider>
                <div className="main">
                    <div className="gradient"></div>
                </div>
                <main className="app">
                    <Nav />
                    {children}
                </main>
            </Provider>
        </body>
    </html>

Yes This is right code

This renders only

Provider
. What did i wrong?

CreativeRoutine avatar Jul 11 '23 11:07 CreativeRoutine