You need to sign in to do that
Don't have an account?
Issue while trying to create Auth Provider
Hello everyone!
I am trying to create a Custom Auth Provider by creating a class that implements Auth.AuthProviderPlugin. I just copied the example shown in the documentation for the API 38, the one I am using, and I tried following the guide at https://help.salesforce.com/articleView?id=sso_provider_plugin_custom.htm&language=en_US&type=0 .
Unfortunately, when I was creating the Auth Provider in SalesForce, I received the following error:
'Custom Metadata Type is either invalid or null . Check the returned type for getCustomMetadataType() method'I have tried using different kinds of return values ('CustomSSO__mdt', 'CustomSSO'...) for getCustomMetadataType() and I have checked thoroughly that the Custom Metadata Type exists and the API Name is the one used in getCustomMetadataType().
I have ended up with just this code as the provider plugin, trying to remove as much as I could from the given example, ending up just with the basic skeleton for the plugin:
global class CustomSSOProviderPlugin implements Auth.AuthProviderPlugin { global String getCustomMetadataType() { return 'CustomSSO__mdt'; } global PageReference initiate(Map<string,string> authProviderConfiguration, String stateToPropagate) { return null; } global Auth.AuthProviderTokenResponse handleCallback(Map<string,string> authProviderConfiguration, Auth.AuthProviderCallbackState state ) { return null; } global Auth.UserData getUserInfo(Map<string,string> authProviderConfiguration, Auth.AuthProviderTokenResponse response) { return null; } global String getTokenValueFromResponse(String response, String token, String ns) { return null; } }I'm pretty sure that I've followed the guide on the SalesForce docs properly, but I can't get past this one error.
If anyone has any idea of how can this solved, help would be very appreciated!
Thanks in advance!
Here is what I did.
1. I first changed the language of the org to English(I always use Japanese).
2. I changed the returned metadate api name value all in lowercases (this gave me an error saying the api name does not mach).
3. Finally I changed back the returned metadate api name to the exactly same name as the api name.
I hope this may help anyone having the same problem :)
global String getCustomMetadataType() { return 'openidtype__mdt'; }
Are you suggesting the same or something else?
Thanks,
In my case, I forgot to add CustomMetadata permission for the user who was loiggin to create an Auth Provider configuration in their Profile or PermissionSet.
Please add the permission using Profile or PermissionSet!
Cheers!