• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

How to implement invitation flow from a shareable link?

Scheduled Pinned Locked Moved Unsolved
Q&A
2
4
7.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    maxfusion
    last edited by 23 Feb 2022, 19:08

    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!

    D 1 Reply Last reply 24 Feb 2022, 14:44 Reply Quote 0
    • D
      dan @maxfusion
      last edited by 24 Feb 2022, 14:44

      @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.

      --
      FusionAuth - Auth for devs, built by devs.
      https://fusionauth.io

      M 1 Reply Last reply 24 Feb 2022, 15:37 Reply Quote 0
      • M
        maxfusion @dan
        last edited by 24 Feb 2022, 15:37

        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 🙂

        D 1 Reply Last reply 7 May 2022, 22:33 Reply Quote 0
        • D
          dan @maxfusion
          last edited by 7 May 2022, 22:33

          @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.

          --
          FusionAuth - Auth for devs, built by devs.
          https://fusionauth.io

          1 Reply Last reply Reply Quote 0
          • First post
            Last post