-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
not being able to use auth() function in the client side #10724
Comments
As mentioned in the official docs, I think your problem is that your |
The variable is not empty. |
Is it possible to check whether the environment variables are accessible correctly by the code? A simple |
Thanks for the suggestion; I went through that path, but the env variable was not accessible since I needed to define it in the I solved the issue by looking at the following links: As for the second problem, looking into the previous discussion. I read that the functions i tried to use are server-side functions and needed to use the client side ones: #9192 (comment) After doing that, I needed to change the baseURL of the session provider to make it work with my project since we had i18n configurations. I think keeping this open for the maintainers to notice the issue would be helpful. I opened an issue for documentation improvements as well: #10720 @khobiziilyes thank you for the help! |
Using I ended up using
next 14.2.3 |
@borzaka can you provide an example of the provider that you had? |
@a0m0rajab I used the official example repo: https://github.com/nextauthjs/next-auth-example/tree/main |
We highly recommend you get the session server-side (with EDIT: Looks like you already figured out a lot of this haha. I'll close the issue then 🙏 |
This need to be added to docs, here (no instructions on getting session in client component when using app router) https://authjs.dev/getting-started/session-management/get-session |
Environment
Reproduction URL
ayasofyazilim-clomerce/ayasofyazilim-core-project#67
Describe the issue
Implementing authjs with credentials provider in my app created the next issue when i used beta.16, I was expecting to use the auth() function immediately and work with it:
Even though I had the secret provided in my .env file it did not detect it.
.env file: has the next variables (I removed them for security reasons)
trial 1:
When I tried to downgrade the version of the library I got a different error:
Error: Invariant: headers() expects to have requestAsyncStorage, none available. #9192
How to reproduce
Expected behavior
I am expecting the auth() function to work on client side.
The text was updated successfully, but these errors were encountered: