prinz
prinz13mo ago

AuthLoading

Hello, I'm using web3auth for user Authentication, and when someone who is unauthenticated tries to access the application, it takes them to the sign-in page, and from there, they go through sign in process, but lets say they cancel while going through the process, the app is stuck at the AuthLoading screen, not sure if there's a way to set timeout with AuthLoading or even better notice there's an error and goes back to the unauthenticated state. this is my convex client provider
No description
12 Replies
Michal Srb
Michal Srb13mo ago
Hey @prinz, I think this is an issue with the Web3AuthProvider or your useAuthFromWeb3Auth hook, it presumably gets stuck in its loading state?
prinz
prinzOP13mo ago
yeah i think so, thanks! Also does convex allow access to the token_id when we set up ConvexcProviderWithAuth, in that it's possible to use convex to get the token for use in a middleware.ts
ian
ian13mo ago
You can get the token from your auth provider directly. And depending on the auth provider, it might be in the headers / cookies and accessible by Next.js middleware. But that is entirely up to the auth libraries. Convex isn't in the loop for Next.js middleware, if I understand correctly
prinz
prinzOP13mo ago
yes, I believe so as well, thanks for clarifying! quick question, what is the auth.config.js file for?
Michal Srb
Michal Srb13mo ago
See one of our authentication guides: https://docs.convex.dev/auth/clerk
Convex Clerk | Convex Developer Hub
Clerk is an authentication platform providing login via
prinz
prinzOP13mo ago
got it, thanks! the reason I was asking was because I wanted to use the Authenticated and Unauthenticated Components and I figured configuring the auth.config.js would help with that, which it does according to the docs. However, after setting that up and configuring the ConvexProviderWithAuth along with the ConvexProviderWithProviderX.js file, I still don't have access to those components
No description
prinz
prinzOP13mo ago
that is my ConvexProviderWithProviderX.js file
Michal Srb
Michal Srb13mo ago
What do you see in your browser console after you log in? You can also add verbose: true to new ConvexReactClient to get more information.
prinz
prinzOP13mo ago
nothing really, the console logging of the token, isAuthenticated and isLoading console.log'ed in page is showing, but for some reason, the same variables are not linking so as to use those components
prinz
prinzOP13mo ago
No description
prinz
prinzOP13mo ago
updated ConvexProviderWithProviderX.js file
No description
Michal Srb
Michal Srb13mo ago
@prinz that browser console.log doesn't show any messages from the ConvexClient besides the websocket reconnected. Are there more messages above? Can you check the sync websocket messages in network tab and see whether there's an "Authenticate" message?

Did you find this page helpful?