I have a custom AuthProviderPluginClass implementation that is working fine for authorization and the related registration handler in my community for External Identity users. I've configured the NamedCredential to use the authprovider, protocol OAuth 2.0, type=Per User. After successfully logging into the community context as a user following the authentication and authorization of the external provider any attempt to access the provider's API returns this message in the logs:
EXCEPTION_THROWN||System.UnexpectedException: You don't have permission to view this data. Ask your administrator to set up authentication for the external data source.
Any ideas on how to grant permission or otherwise bypass this for the very same external data source from which the user has already authenticated and authorized?
ExernalDataUserAuthobject via Metadata API or (if you're really brave) via DML in Apex.