Friday, 8 February 2019

Oracle APEX and Google reCAPTCHA v3

Google reCAPTCHA v3

 

How to integrate reCAPTCHA v3 into APEX?


Oracle APEX and reCAPTCHA v3 integration


Some of you may know that APEX plugin for reCAPTCHA v2 has been available for a while which you can download here thanks to Mohamed Zebib.  



In October 2018 Google announced new version which now does not require any user interaction what so ever unlike version 2 where websites had


and users had to click I'm not a robot checkbox. 

This post is about integration it into your APEX apps. Let's have a look how.

For simplicity we will do it on Login page - P9999 where before user is allowed to login we will run a reCAPTCHA check.
All about reCaptcha v3 you can find at https://developers.google.com/recaptcha/intro

Implementation

Step 1.
To start using reCAPTCHA, you need to sign up for an API key pair for your site. Why? 
"The key pair consists of a site key and secret key.

The site key is used to invoke reCAPTCHA service on your site or mobile application.
The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user's response. "

Step 2.
Create Application settings that will store your public and secret keys like

Give them any name you want. 

Also create application process and application item. Something like this
:APP_RECAPTCHAV3_SITE_KEY := APEX_APP_SETTING.GET_VALUE( p_name => 'RECAPTCHAV3_SITE_KEY');

Where APP_RECAPTCHAV3_SITE_KEY is application item getting set.

Step 3.
On your login page add lines to initialize reCAPTCHA as per https://developers.google.com/recaptcha/docs/v3



Try running the page if you have done all things correctly you should get the famous logo running on the page.