I am trying to get JWT Bearer Token Flow to work. But get the error user hasn't approved this consumer. I have read these posts:
Salesforce JWT User Hasn't Approved This Consumer (Again)
OAuth 2.0 JWT Bearer Token Flow
OAuth 2.0 JWT Bearer Token Flow giving a user hasn't approved this consumer error
and all seem to say the same, that the application needs to be authorized. I am doing this, but still get the error. Is there something else that I am missing?
Authorize
POST https://login.salesforce.com/services/oauth2/authorize HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: login.salesforce.com
Content-Length: 151
Expect: 100-continue
Connection: Keep-Alive
response_type=code&client_id=3MV...4QJ3&redirect_uri=https%3A%2F%2Flocalhost
JWT Request
POST https://login.salesforce.com/services/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: login.salesforce.com
Content-Length: 666
Expect: 100-continue
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJ...pjCY1Ug
JWT Response
HTTP/1.1 400 Bad Request
Date: Sat, 10 Feb 2018 13:40:45 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: upgrade-insecure-requests
Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private
Set-Cookie: BrowserId=A1Sl9NmzQ5eoVt_etmmBbg;Path=/;Domain=.salesforce.com;Expires=Wed, 11-Apr-2018 13:40:45 GMT;Max-Age=5184000
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 82
{"error":"invalid_grant","error_description":"user hasn't approved this consumer"}