I have created a custom Auth Provider and a named credential. I then deployed it to my org as a system administrator. When I tried adding the named credential to User -> Authentication Settings for External Systems, I received an Insufficient Privileges error below:
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors.
Here is my auth provider config:
<AuthProvider xmlns="http://soap.sforce.com/2006/04/metadata"> <executionUser>email@example.com</executionUser> <friendlyName>MyCloudOAuthProvider</friendlyName> <plugin>MyCloudOAuthProvider</plugin> <customMetadataTypeRecord>AuthMeta__mdt</customMetadataTypeRecord> <includeOrgIdInIdentifier>false</includeOrgIdInIdentifier> <providerType>Custom</providerType> <sendAccessTokenInHeader>false</sendAccessTokenInHeader> <sendClientCredentialsInHeader>false</sendClientCredentialsInHeader> </AuthProvider>
AuthMeta__mdt has my key, secret, authorize URL and token URL configured.
All configs are added to the package.xml. The classes and permissions are added to the admin profile.
When I delete the Auth.Provider and recreate it manually in Setup -> Auth.Provider, it works.
Am I missing something for the migration tool deploy?