I have created connected App using metadata API,Now I have to retrieve connected App's Information using metadata API,The code is working fine for the Apps which is created manually but not for the Apps which is created through metadata .I have provided full access for both connected Apps.
public static void retrieveConnectedApp() {
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
MetadataService.ConnectedApp connectedApp =
(MetadataService.ConnectedApp)service.readMetadata('ConnectedApp', new String[] {'ActivePrime' }).getRecords()[0];
}
Is there any security issue ? For Oauth authentication, connected app (manually) is working fine but connected app (Metadata API) failed .
MetadataService.ConnectedApp
?