Closed SanthoshIndukuri22 closed 2 years ago
@SanthoshIndukuri22
Please change your url from https://workday--uat.my.salesforce.com
to https://workday--uat.my.salesforce.com/services/oauth2/token
.
let me know if that works.
thank you
It's 404 now.
C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main>python src/main.py using program arguments [] salesforce token request failed. status-code:404, reason: Not Found error authenticating with https://workday--uat.my.salesforce.com/token
please try this url: https://workday--uat.my.salesforce.com/services/oauth2/token
@shahramk salesforce token request failed. status-code:400, reason: Bad Request error authenticating with https://workday--uat.my.salesforce.com/services/oauth2/token
must be your credentials. where do you obtain your client_id, client_secret, and client_password? do you append the salesforce access token to your client_password in the yml file?
This is how I have. Haven't appended token url to client secret.
token_url: "https://workday--uat.my.salesforce.com/services/oauth2/token" auth: { "grant_type": "password", "client_id": "**", "client_secret": "**", "username": "", "password": "****" }
@shahramk Appreciate any update here. Thank you!
Setting the user permissions to self authorize for all apps resolved the issue
@SanthoshIndukuri22 - thank you for update.
Hello,
We get the parsing errors complaining about JSON, we validated the config.yml file but nothing looks suspicious. Attached full package.
When executing main.py file, we get below output.
C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main>python src/main.py using program arguments [] Traceback (most recent call last): File "C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main\src__main.py", line 102, in
main()
File "C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main\src\ main.py", line 79, in main
integration.run()
File "C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main\src\newrelic_logging\integration.py", line 48, in run
if not client.authenticate_with_password(sfdc_session):
File "C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main\src\newrelic_logging\salesforce.py", line 173, in authenticate_with_password
resp_json = resp.json()
File "C:\Program Files\Python310\lib\site-packages\requests\models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Program Files\Python310\lib\json\init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 2)
C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main>
Curl outputs for the target uri. Credentials are valid. We do not have JWT bearer flow in our environment , its either authorization_code or password. We tried both the grant_types in config.yml as well but no luck.
--> We tried to curl the target url and grant type as authorization_code and it errors invalid authorization code
C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main>curl -X POST -F "grant_type=authorization_code" -F "client_id=" -F "client_secret=***" -F "username=*" -F "password=*****" -F "redirect_uri=https://insights-collector.newrelic.com/v1/accounts/2485673/events" https://workday--uat.my.salesforce.com/services/oauth2/token {"error":"invalid_grant","error_description":"invalid authorization code"}
-->We tried to curl the target url and grant type as passport and it's authentication failure
C:\Users\santosh.indukuri.adm\Documents\newrelic-logs-salesforce-eventlogfile-main>curl -X POST -F "grant_type=password" -F "client_id=" -F "client_secret=" -F "username=" -F "password=" -F "redirect_uri=https://insights-collector.newrelic.com/v1/accounts/2485673/events" https://workday--uat.my.salesforce.com/services/oauth2/token {"error":"invalid_grant","error_description":"authentication failure"}
We wonder there is an issue with the config.yml format which wouldn't identify. Can you please review and let us know the root cause?
newrelic-logs-salesforce-eventlogfile-main.zip config.txt