Questions Related to Before/After Authentification Hook functions

Hi @Opeth001,
You can check out this A way to know if a user is doing a sign in or sign up from google login post . I think it’ll answer most of your queries -

Also I’ll try to answer your queries here from my understanding of nakama,
1 - You can send the custom values with authentication request and access them inside the payload received in before hook. I think it’s not available yet on client side. Check out that post for more info and someone on the nakama team can clarify that for you.
2. Authentication before hook is triggered before authentication process even starts. Before hook for any type of request always executes first. If you don’t return the payload from before hook, request is not performed and returns back to client with error.
3. No, you can’t know that in before hook as authentication is not done in before hook unless you make a custom SQL call to db to know that which is not very efficient. But yes, you can know that inside the after hook, check for session object’s Created field for that.
4. Yes, you can access the initial request payload passed inside the after hook. Check here https://heroiclabs.com/docs/runtime-code-basics/#after-hook
5. As far as I understood, that metadata is related to wallet transaction. You can store custom info regarding a particular wallet transaction inside that metadata field.

I hope this helps.

2 Likes