Disable a query based on non-available auth tokens

Hi there. I'm running into an issue and have been for a while.

As per this post it's not possible to save the custom auth variables for later usage within the app and they are only accessible on resources. That being said, is there any way to disable a query (which otherwise runs automatically on app startup) by checking for the existence of these magic variables set during the custom auth process?

My issue is basically that I'm getting an automatic 401 every time I start the app (because I'm not yet authenticated) and I'm trying to avoid that since it's triggering alarms unnecessarily in our system. Low hanging fruit would be setting the query to be triggered manually by a button instead of automatically on app startup, but I'd rather keep that as a last resort since it's really crappy in terms of UX.

Any suggestions?


Hey there, thanks for reaching out about the issue you're encountering with your auth query running automatically and triggering 401 errors. While I can't confirm whether your specific approach is ideal, you can potentially restrict the query's execution based on user permissions. Retool allows assigning roles and permissions to users, giving you granular control over what queries they can run. Here is some documentation you may find useful.

You can also consider using custom logic within your Retool app to check for authentication status on app load before running the query. The logic could utilize the app.currentUser object or other auth methods to verify if the user is authenticated before allowing the query to run.