Is it possible to use the v4 beta of Auth0's Next.js SDK with Convex?
Hello, I am trying to figure out if making a custom integration of Auth0's Beta v4 Next.js SDK would work in Convex Authentication? I did try to make one, the problem is it always show that I am unauthenticated. Is there something I'm doing wrong? Any help is appreciated, thank you.
Versions I am using:
-
"@auth0/nextjs-auth0": "4.0.0-beta.13"
- "convex": "^1.17.4"
- "next": "15.1.3"
Source code:
- Custom auth integration: https://pastebin.com/DMPJDfXH
- Convex client: https://pastebin.com/DJZ0sfau
- Page/Route client: https://pastebin.com/RbeCXSrCPastebin
Custom auth integration with Convex - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Convex client - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Page client - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
19 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
anyone's help would be appreciated, thank you
Definitely should be possible. Are you using an auth0 provider? Don’t see it in the provider file you shared.
Yep, I am using an Auth0 provider though I may have forgotten to include it in the pastebins
auth.config.ts
I did some digging at Convex's package, I found out that
backendReportsIsAuthenticated
from client.setAuth
returns false. I don't know how or what's the procedure to have this property set to true.
With that, I don't really know where or what's the problem ;/Dang. If you can share a repo that reproduces this I can take a look in the morning.
Yea sure i'll make a repo real quick
Here's the exact project that I am working on (well, mostly testing Convex first) https://github.com/NvermindLabs/convex-auth0
GitHub
GitHub - NvermindLabs/convex-auth0
Contribute to NvermindLabs/convex-auth0 development by creating an account on GitHub.
Also, this is the GitHub repository of the version of Auth0 that I am using. https://github.com/auth0/nextjs-auth0/tree/v4.0.0-beta.13 (sending this just so we're clear lol)
GitHub
GitHub - auth0/nextjs-auth0 at v4.0.0-beta.13
Next.js SDK for signing in with Auth0. Contribute to auth0/nextjs-auth0 development by creating an account on GitHub.
Awesome, thanks for this 👍
Alright, thanks.
@ark do you specifically require this beta version of the auth0 next package for some functionality or are you just trying to get auth0 working with Next v15 and Convex?
I do require the beta version. The version 4 of Auth0 supports Next.js 15, while the older versions won't.
Source: https://github.com/auth0/nextjs-auth0/issues/1808
GitHub
Announcing the Beta Release of nextjs-auth0 SDK v4 🎉 · Issue #1808 ...
Hello everyone, We're thrilled to announce the beta release of nextjs-auth0 SDK v4! This new version brings significant improvements, new features, and fixes to enhance your development experie...
I just ran into Auth0's React client not supporting React 19, although it works fine with
--legacy-peer-deps
.
@ark Do you have this auth0 library working without Convex? Working through your repo it seems like it's missing some steps from the setup in the README of https://github.com/auth0/nextjs-auth0
@ark it looks like you're passing in an access token instead of an identity token
I don't see a straightforward to to get an identity token with this library
I wired something working here https://github.com/NvermindLabs/convex-auth0/compare/main...thomasballinger:convex-auth0-repro:directionally-right
I had to add a callback URL to the Auth0 app and had trouble with envars so hardcoded domain
but that's just normal setup for this library
The Identity Token is doesn't hit the browser unless you send it explicitly by customizing beforeSessionSaved
Yep, auth0 works fine without using convex
Thanks for that! I will test it once I got back home
It's not a finished integration, you might test with a small refresh time to make sure it works with refreshing.
Thank you, @ballingt. I just tested it, and everything works, even with refreshing. Perhaps the sort of issue of not having a direct method to get the ID token could be brought to the Auth0 team working with the Next.js SDK, but hey, it works now. Thank you as well @erquhart.
GitHub
GitHub - auth0/nextjs-auth0: Next.js SDK for signing in with Auth0
Next.js SDK for signing in with Auth0. Contribute to auth0/nextjs-auth0 development by creating an account on GitHub.
@ark I filed this at https://github.com/auth0/nextjs-auth0/issues/1859
GitHub
Expose ID token more simply · Issue #1859 · auth0/nextjs-auth0
Checklist I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer. I have looked into the API documentation and have not found a suitable solution or answe...
Great!