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.
    • danD
      dan
      last edited by

      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

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @dan
        last edited by

        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
        • danD dan has marked this topic as solved on
        • First post
          Last post