• Resolved jeffsmor

    (@jeffsmor)


    Hi,

    I’m trying your plugin to receive leads from Google, but the maximum length allowed by Google is 50 characters. Is there a filter that limits the length of the api key?

    Great work by the way!

    tks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ironikus

    (@ironikus)

    Hey @jeffsmor – thank you a lot for your message, as well as for your feedback (highly appreciated!).

    We currently do not have any visible way of changing the length of the webhook key, but I just added that on our list of features.

    Alternatively, you can also define the two parameters (wpwhpro_api_key and wpwhpro_action) in the payload instead in the URL as query parameters. This way you would only need to add the website and these details within the payload.

    Hope this helps so far. If you have further questions, feel free to let me know.

    Plugin Contributor Ironikus

    (@ironikus)

    Hey @jeffsmor – Thank you for your patience on this task. I just wanted to inform you that we launched a feature for that in one of our previous versions. ??

    Here is the filter that allows you to manipulate the length of the API key that is being generated:
    apply_filters( 'wpwhpro/admin/webhooks/generate_api_key', $password, $length )

    You can also read more about it here: https://ironikus.com/docs/knowledge-base/filter-generated-api-key-for-action-urls/

    Lastly, here is a code snippet that you can add to your functions.php file to limit the length of the API key to 48 characters instead of 64. Simply paste it into your functions.php file to make it work. Once you create then a new webhook URL, the API keys will follow the new 48 characters setup:

    add_filter( 'wpwhpro/admin/webhooks/generate_api_key', 'ironikus_generate_shorter_version_of_webhook_token', 10, 2 );
    function ironikus_generate_shorter_version_of_webhook_token( $password, $length ){
    
    	$length = 48; //Customize the length here
    
    	return strtolower( wp_generate_password( $length, false ) );
    }

    Please note: Limiting the length of the API key weakens the strength of the security. Therefore, only limit it to the maximum of characters allowed for your use-case.

    If you have any further questions, please let me know. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set limit to Api key’ is closed to new replies.