so I generated and uploaded self-signed certificate, created an app, selected "Admin approved users are pre-authorized", added username role to approved list and wrote following code (using Ruby and Restforce library):
Restforce.configure do |config| config.username = "username" config.client_id = "production_client_id" config.client_secret = "production_client_secret" config.instance_url ="production_instance_url" config.jwt_key = "jwt_key" config.api_version = '48.0' end
It works completely fine! I can connect to the API and have full access.
Then I created sandbox, app has been copied to sandbox too. I replaced username, client_id, client_secret, instance_url with sandbox settings. Run "Restforce.new.describe" again and it shows and error:
invalid_grant: user hasn't approved this consumer (400)
What I tried:
1) Change from "Admin approved users are pre-authorized" to "All users may self-authorize", login to test instance with user credentials (permissions are displayed) and confirm.
2) Create new app on sandbox from scratch.
3) Change username from "firstname.lastname@example.org" to "email@example.com" (as on production).
None of the above works for me. The error is the still the same (I read 1st hack helped some people but it doesn't work for me).