You need to sign in to do that
Don't have an account?
How can I programmatically get the ID of an Identity Auth. Provider registered in Salesforce?
All of the documented AuthToken methods seem to pass hardcoded values for the Identity Auth. Provider Id (see documentation here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Auth_AuthToken.htm).
Samples:
String accessToken = Auth.AuthToken.getAccessToken('0SOD000000000De', 'Open ID connect');
Map<String, String> responseMap = Auth.AuthToken.refreshAccessToken('0SOD000000000De', 'Open ID connect', accessToken);the
I know that using hardcoded Id values in Apex is a no-no, but to get my code up and running, I quickly used hardcoded ID values for Identity Auth Providers in my code. Everything works great in the sandbox, but now that I'm getting ready to deploy to Prod, I'm aware that I'll run into issues. Auth Providers deployed into Production will have a different Id value than those created in the Sandbox. I need to harden the apex code so that it no longer uses these hardcoded Auth Provider ID values.
How can I get the Id value of an Identity Auth Provider regsitered in my org? I don't think I can pull that back with a SOQL statement (similar to how I'd pull back Id values of Profiles, Queues or other objects, can I?
SELECT id FROM ???
Thanks for the help, bonus karma points for sample code!