Michael
Michael4mo ago

Convex Auth Missing SITE_URL in Expo App

The docs say that SITE_URL is not needed when I am using react native. For my expo app I am getting an error regarding missing env SITE_URL. Is there anything I am missing or is SITE_URL actually required?
No description
No description
9 Replies
Convex Bot
Convex Bot4mo ago
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!
ian
ian4mo ago
Did you set the redirecTo param and redirect callback like in https://labs.convex.dev/auth/config/oauth#add-sign-in-button ? Make sure to use the ReactNative selector. here's the code that was throwing the error I believe
OAuth - Convex Auth
Authentication library for your Convex backend
GitHub
convex-auth/src/server/implementation/redirects.ts at 1ed1f410ef3bf...
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
Michael
MichaelOP4mo ago
I am using OTP with resend, does this method work with that or is it specific to OAuth?
ian
ian4mo ago
I would configure the SITE_URL for your app's url, have you tried that? I haven't played with RN & auth much, but any time a user needs to get redirected to your app, I'd suspect you need to provide a URL
Michael
MichaelOP4mo ago
It works but for some reason also have to manually setup the private and public key as well or else it errors. I was under the impression that npx @convex-dev/auth sets that up for us.
Michael
MichaelOP4mo ago
No description
ian
ian4mo ago
have you run that command? does it say it's setting the values or already has the values? You can see all your set environment variables with npx convex env list
sshader
sshader4mo ago
I think you're running into https://github.com/get-convex/convex-auth/issues/40 -- sounds like setting a dummy SITE_URL will probably unblock you (or setting it to the URL of your Expo app) npx @convex-dev/auth is supposed to set up JWKS and JWT_PRIVATE_KEY for you, so sounds surprising that you had to manually set them -- if you remember more details / have logs from your initial npx @convex-dev/auth handy, feel free to share them
GitHub
OTPs should not require SITE_URL · Issue #40 · get-convex/convex-au...
https://discord.com/channels/1019350475847499849/1263635045483155556 It's because we always generate the URL that includes the code param, even in the case of OTPs. This comes from the shape of...
Michael
MichaelOP4mo ago
okay I deleted the env variables and tried it again, seems like JWKS and JWT_PRIVATE_KEY is set but only SITE_URL is not because its a react native app. I think the "React Native projects don't require a SITE_URL" is kind of misleading thou because it required one to work. As for the issue, I think its https://github.com/get-convex/convex-auth/issues/40 , setting the SITE_URL fixes it 👍 .
GitHub
OTPs should not require SITE_URL · Issue #40 · get-convex/convex-au...
https://discord.com/channels/1019350475847499849/1263635045483155556 It's because we always generate the URL that includes the code param, even in the case of OTPs. This comes from the shape of...
No description

Did you find this page helpful?