I have set up a Custom app on an enterprise-edition org to deploy source to, and am able to authorize using force:auth:jwt:grant on my dev machine (Windows 10), but the build machine (Windows Server 2016 10.0.14393) consistently connects to a different organization than the one the connected app is defined in.
As a result, the deploy fails.
The server had connected to another org which has since been deleted. A new organization was created with the same name and user login, and the certificate loaded into a connected app on that organization. I have confirmed the server is using the new consumer key for the connected app.
Any suggestions on how to get around this?
Commands on server:
sfdx force:auth:jwt:grant -i [certificate] -f server.key -u [email protected] -a enterprise
response:
Successfully authorized [email protected] with org ID 00D5A00000080jQUAQ
sfdx force:source:deploy -p .\force-app\main\ -w 10 -u enterprise
response:
ERROR running force:source:deploy: This org appears to have a problem with its OAuth configuration. Reason: invalid_grant - user hasn't approved this consumer
username: [email protected],
clientId: [different client id],
loginUrl: https://login.salesforce.com,
privateKey: server.key
Try this:
Verify the OAuth configuration for this org. For JWT:
Ensure the private key is correct and the cert associated with the connected app has not expired.
Ensure the following OAuth scopes are configured [api, refresh_token, offline_access].
Ensure the username is assigned to a profile or perm set associated with the connected app.
Ensure the connected app is configured to pre-authorize admins.
Commands on dev machine:
sfdx force:auth:jwt:grant -i [certificate] -f server.key -u [email protected] -a enterprise
response:
Successfully authorized [email protected] with org ID 00D6g000001Y9z2EAC
sfdx force:source:deploy -p .\force-app\main\ -w 10 -u enterprise
response:
=== Deployed Source...