I'm implementing multi-tenant authentication with custom OAuth state parameters using Wasp's auth hooks. I have a onBeforeOAuthRedirect hook configured in my main.wasp file like this:
My hook implementation looks like: export const onBeforeOAuthRedirect = async ({ url, oauth, prisma, req }) => { console.log(' Auth Hook: onBeforeOAuthRedirect triggered') // Logic to modify OAuth URL with custom state parameter return { url: modifiedUrl } }
Questions: 1. Are onBeforeOAuthRedirect hooks supported for Keycloak OAuth method, or only for social providers like Google/GitHub? 2. Do auth hooks require server restart after adding them to main.wasp, or should they hot-reload? 3. What's the exact format/signature expected for the onBeforeOAuthRedirect hook return value? 4. Are there any console logs or debugging methods to verify auth hooks are being registered and called? 5. Does the hook fire before the initial redirect to Keycloak, or at a different point in the OAuth flow?
I'm not seeing any console logs from my hook, which suggests it's either not being called or not properly registered. Any insights on troubleshooting auth hooks would be helpful!