function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ravi RoyRavi Roy 

How to customize the process of oAuth in connected app through apex class plugin?

What I'm planning is to extract extra parameter provided in the url that I'll use as some key from my end along with the salesforce standard key and if that maches then further provide the access token to the client.In simple I want to customize the standard process of authentication.
NagendraNagendra (Salesforce Developers) 
Hi Ravi,

Salesforce provide two ways of handling the authentication request comes to it. If you are using any third party application as a auth provider and salesforce as a Service provider then you can define Auth. Provider in your salesforce org. There you can define the RegistrationHandler apex class (which implements implements Auth.RegistrationHandler interface) and it has two method which you need to override. You can get use Auth.UserData to get the input parameter into those methods. This UserData parameter will be look like below.

UserData:[attributeMap={email=sompaul2012@gmail.com, email_verified=true, family_name=Paul, gender=male, given_name=Somnath, locale=en, name=Somnath Paul, picture=https://lh4.googleusercontent.com/-8Xvq8DkZSwk/AAAAAAAAAAI/AAAAAAAAAAA/AB6qoq2XO01PNhrlvircZvEPeXV-EcmLyQ/mo/photo.jpg, profile=https://plus.google.com/114773082042765818892, sub=114773082042765818892, ...}, email=sompaul2012@gmail.com, firstName=Somnath, fullName=Somnath Paul, identifier=114773082042765818892, lastName=Paul, link=https://plus.google.com/114773082042765818892, locale=en, provider=Google, siteLoginUrl=null, username=null]

If you are using SSO and any third party application as an authentication provider, then Use the JIT provision in SAML based Single Sign On and customize the apex class which implements Auth.SamlJitHandler.
You will get the same attribute map like above with all the user related details in a name value pair.

Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra