How to implement invitation flow from a shareable link?
-
My invite flow requirements are as such:
1] Backend generates a shareable link for existing user X... ie example.com/invite/123
2] Existing user X shares this link to FB/Twitter/etc.
3] When someone clicks this invite link (user Y), it first hits my server which plants a cookie w/ the invite id (123), then redirects user Y to the FA registration screen.
4] Once user Y successfully creates an account via email or social ID provider (FB, Google, Apple, etc), this invite id (123) needs to be propagated to user.create webhook somehow (user data, etc), so that I can update my DB that newly created user Y has been referred by user X.
Is there some way in FusionAuth to implement this invite flow? Thanks! -
@maxfusion If you are using the advanced registration form (which is a paid feature, available in the starter edition), you should be able to add a custom user.data field (refererId) and then in the registration theme pull the value off the cookie (using the request object) and save it to that field. Then, when creation is complete, the user.data.refererId field should be available to the webhook.
Hope that helps.
-
Thank you @dan! Will that approach work when user signs up with FB/Google/Apple/etc identity providers?
I figured out another way to solve my problem... and that is to rely on state query param which would redirect the user to /acceptinvite/123 post signup which would update user profile and then redirect the user to the default logged in page. And this approach works with social logins also. It's not ideal, but accomplishes the goal
-
@maxfusion said in How to implement invitation flow from a shareable link?:
Will that approach work when user signs up with FB/Google/Apple/etc identity providers?
It should.
Glad you found a way that worked for you.