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

Passing data from login form to webhook

Scheduled Pinned Locked Moved Solved
Q&A
1
2
1.1k
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.
  • D
    dan
    last edited by 15 Sept 2023, 20:30

    I have a URL param on the login page that I want to pass to a login success webhook handler.

    How can I do so?

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

    D 1 Reply Last reply 15 Sept 2023, 20:33 Reply Quote 0
    • D
      dan @dan
      last edited by 15 Sept 2023, 20:33

      There is no official way to do this but you can overload one of the custom fields as outlined here.

      Here's sample code to do this, assuming that the parameter you want to track is registrationCode.

      <script>
      const queryString = window.location.search;
      let urlParams = new URLSearchParams(queryString);
      
      const registrationCode = urlParams.get('registrationCode');
      
      if (registrationCode) {
          console.log('New query string found of '+ registrationCode);
          let input = document.querySelector('.customParam');
          input.setAttribute('value', 'registrationCode = ' + registrationCode);
          console.log(input.type, input.name, input.value);
      }
      </script>
      

      Then, in the login form, you want to make sure you have this input field:

      <input class="customParam" type="hidden" name="metaData.device.description"/>
      

      The value of metaData.device.description in the webhook event will be the value of the registrationCode parameter.

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

      1 Reply Last reply Reply Quote 0
      • D dan has marked this topic as solved on 15 Sept 2023, 20:34
      2 out of 2
      • First post
        2/2
        Last post