I'm confused about how the configuration of connected apps in a 2GP work. I've found a couple helpful pages in the documentation, but feel I'm still missing some important details.

I currently have a 2GP that contains a connected app. This connected app is defined in a Metadata file. From the documentation I understood that the connected app is actually defined in a first-generation package (ref). So I have created a 1GP, added a connected app, released that package and then pulled the source into my 2GP. That all works fine.

However, now I'd like to add a scope to the OAuth scope of the connected app. I've tried this in multiple ways but cannot figure out how to. I think I simply do not understand the basics of 2GPs and Metadata API enough. Could somebody help me understand this better?

  1. What is the function of a Metadata XML file? Making changes to the OAuth scopes does not seem to have any impact. If the metadata file differs from the connected app definition, that does not seem to bother SFDC either. What does it use this file for?
  2. When I refer to a connected app from a canvas application, how does the 2GP know what connected app to connect to? The connected app has a name and namespace, but when I retrieve the source, this is not showing in the metadata file. Is it simply the filename?
  3. What are the exact steps to update a connected app, or another object, in a 2GP?


You must log in to answer this question.