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
Mani PenumarthiMani Penumarthi 

How to get consumer Key and Secret Key of ConnectedApp dynamically in apex class?

Shiva Ramesh @ xcdhrShiva Ramesh @ xcdhr

Hi Manikumar


If you need to get consumer key and consumer secret then go to App Setup-> Develop ->Remote Access. Here you can create your new remote access ,  you will also get the consumer Key and consumer secret.


Check this following link:


Use remote access to specify remote access applications, that is, applications external to that use the OAuth protocol to verify both the user and the external application. OAuth is an open protocol that allows secure authentication.

Mani PenumarthiMani Penumarthi
Thanks Ramesh.

What I actually need, is to pass the values of the consumerKey and Secret
Key in the url used in the class. So, how do we retrive those values
dynamically? I have multiple connected App's based on the cretria I need to
select the RemoteAccess.

Thanks & Regards,
Mani kumar P
Mani - did you figure out how to do this? I am looking to solve a similar problem - trying to read key & secret into a Apex class.
Mani PenumarthiMani Penumarthi

As  per my research, we can't get the them dynamically. So I have written a VF page to enter the Key and secret values and validate them accordingly

Please correct me if I was wrong and share me if you could find any better solution.