Anima
Anima
WWasp-lang
Created by Anima on 8/20/2024 in #đŸ™‹questions
Create API endpoint for external service
Wow, that was super fast. kapa's suggestion to add "auth: false" has done it, thanks! đŸ™‚
10 replies
WWasp-lang
Created by Anima on 8/6/2024 in #đŸ™‹questions
Auth hooks not triggering
I suppose this would look maky my app/src/auth/hooks.ts script look like
import type { OnAfterSignupHook } from 'wasp/server/auth';

export const onAfterSignup: OnAfterSignupHook = async ({ providerId, user, oauth, prisma, req }) => {
await Reflio.signup('[email protected]')
};
import type { OnAfterSignupHook } from 'wasp/server/auth';

export const onAfterSignup: OnAfterSignupHook = async ({ providerId, user, oauth, prisma, req }) => {
await Reflio.signup('[email protected]')
};
, right? This understandably causes wasp start to fail with
[ Wasp ] ext-src/auth/hooks.ts(4,9): error TS2304: Cannot find name 'Reflio'.
, but I don't know how I could import Reflio when it's defined in this line
"<!-- Reflio JavaScript snippet --><script async src='https://reflio.com/js/reflio.min.js' data-reflio='k24yx3y8webd50n'></script>"
"<!-- Reflio JavaScript snippet --><script async src='https://reflio.com/js/reflio.min.js' data-reflio='k24yx3y8webd50n'></script>"
, which I added to the head in main.wasp I suppose this may no longer be strictly a Wasp-related question, but in case this is a fairly common pattern in Web development and if you could point me in the right direction, it would be a great help!
11 replies
WWasp-lang
Created by Anima on 8/6/2024 in #đŸ™‹questions
Auth hooks not triggering
Actually the hook I'm trying to implement is mentioned in this question, but I'm a little lost because as far as I understand this code from Reflio
<script type="text/javascript">
await Reflio.signup('[email protected]')
</script>
<script type="text/javascript">
await Reflio.signup('[email protected]')
</script>
` needs to run on the client side, but the hooks are run on the server side. Do I need to create an endpoint on the client so the server can indirectly trigger this script?
11 replies
WWasp-lang
Created by Anima on 8/6/2024 in #đŸ™‹questions
Auth hooks not triggering
Ah, this might be a classic case of PEBCAK đŸ˜† So, I guess since the hook runs on the server and not the client, it doesn't show up in the console logs. Terminal logs show the hook is triggered:
[ Server ] GET /auth/me 401 26.174 ms - 43 [ Server ] GET /auth/me 401 0.597 ms - 43 [ Server ] GET /auth/me 401 0.887 ms - 43 [ Server ] GET /auth/me 401 0.516 ms - 43 [ Server ] GET /auth/google/login 302 0.479 ms - - [ Server ] onAfterSignup hook triggered
I still get some 401 on /auth/me, is this normal?
11 replies