Tested on AEM 6.5.0
As we all know that AEM provides multiple types of Authentication out of the box using Sling's AuthenticationHandler API.
Today we will see how we can utilise OAuth Authentication Handler to integrate Google OAuth2. All the code required for this is available on GitHub.
1. Understanding of OAuth 2 Authorizaion code grant type
2. Client Id and secret of an Application registered on Google dev console.
-->In Allowed Redirect URIs add: /callback/j_security_check. Eg.- localhost:4503/callback/j_security_check
3. Basic understanding of scribe-java library. Alert - AEM uses very old version of scibe-java library which we can't upgrade if we want to utilise the OOTB OAuthAuthenticationHandler
OAuth Authentication Handler Background
AEM developed its whole OAuth flow around the Scribe-Java library and provides OOTB working solution for Facebook and Twitter which we can test on We.Retail sample site in publish mode.