After creating an Auth. Provider (in my case it is Provider Type = "Salesforce"), I am presented in the Setup UI with 5 URLs under "Client Configuration", including the SSO Initialization URL and Callback URL.

I have the feeling that I recently stumbled upon an article how to retrieve these via Apex / SOQL / API, but I can't find it anymore and have no proof.

Is it possible to retrieve these URLs via SOQL, by providing just the Auth. Provider ID? If yes, how?

2 Answers 2


I just found the article again to get an Auth. Providers SSO Init URL:

AuthConfiguration Class

AuthConfiguration class has a static method getAuthProviderSsoUrl(communityUrl, startUrl, 'developerName');

It build you the SSO Login URL including the community and startURL parameter. If you set both communityUrl and startUrl method parameters to NULL, it returns only the SSO init URL.

Interesting fact: If you set the methods first two parameters to NULL, the SSO Login URL includes the Salesforce instance (e.g., https://na16.salesforce.com), if you set them not to NULL, the SSO Login URL starts with https://login.salesforce.com.

To be fair, this approach does not return all the Client Configuration URLs from an Auth. Provider, but the SSO Login Url is IMO the most important to get users logged in through custom login controllers.

  • I want to know where we need to add this method? Is there any class available to update? or create and associate to Auth.Providers? Sep 19, 2018 at 16:35

Connected App data is stored as Metadata so it is not accessible through a SOQL query.

ConnectedApp components have the suffix .connectedapp and are stored in the connectedapps folder.

Additional details are here:


However, you can use the MetaData API to access the setup information. Most examples show how to do this through Java app. However, there are several articles on how to do this using Apex. Here is one example of how to call the Metadata API from within Apex:


  • 1
    Thanks for the answer, Christian, but I was looking for the "other side" of a Connected App, i.e. the Auth. Provider. I see the documentation provides also info on AuthProvider meta data, but this doesn't include the SSO Initilization URL or Callback Url, unfortunately. May 5, 2015 at 7:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .