-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting "expired authorization code" error while creating JWT token #31
Comments
Subscribing, getting same issue |
Hi @Ashutosh2547 and/or @kanwaljit-mq can you please provide your full I have found two things I would like to ask you to check on the Salesforce side. Can you ensure what the expiration date on the token is set to? I think this may be the "Token Timeout" described in the last paragraph here. Can you also check the system time on the machine where the exporter is running? I've seen a few posts where people indicated that incorrect system times caused this error. |
@Ashutosh2547 This is how I fixed the issue and I am sure there is an elegant way to do it besides this. |
Thanks @kanwaljit-mq , |
Hi @kanwaljit-mq and @Ashutosh2547 , can you update your remote and checkout the branch |
@kanwaljit-mq @Ashutosh2547 PR #39 is now merged to |
Reopening this issue to address the error reported by @kanwaljit-mq here |
@kanwaljit-mq This should fix it. I admit that I don't have an environment to test JWT authentication so it's possible there are still issues. Please give this a go and let me know how it works. |
Description
After configuring the config.yml to point to the connected app and using the grant_type "jwt-bearer". Getting 400 bad request
Steps to Reproduce
Getting below error in auth.py
raise LoginException(f'sfdc token request failed. http-status-code:{resp.status_code}, reason: {resp.text}, full response {resp}')
newrelic_logging.LoginException: sfdc token request failed. http-status-code:400, reason: {"error":"invalid_grant","error_description":"expired authorization code"}, full response <Response [400]>
Expected Behavior
JWT token should be retrieved and app should pull the data from SFDC.
Relevant Logs / Console output
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src_main_.py", line 272, in main
run(config, event_type_fields_mapping, numeric_fields_list)
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src_main_.py", line 213, in run
run_once(
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src_main_.py", line 165, in run_once
).run()
^^^^^
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src\newrelic_logging\integration.py", line 41, in run
raise e
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src\newrelic_logging\integration.py", line 37, in run
instance.harvest(session)
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src\newrelic_logging\instance.py", line 24, in harvest
self.api.authenticate(session)
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src\newrelic_logging\api.py", line 81, in authenticate
self.authenticator.authenticate(session)
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src\newrelic_logging\auth.py", line 197, in authenticate
self.authenticate_with_jwt(session)
File "C:\Application_Development\Personal\newrelic-salesforce-exporter\src\newrelic_logging\auth.py", line 147, in authenticate_with_jwt
raise LoginException(f'sfdc token request failed. http-status-code:{resp.status_code}, reason: {resp.text}, full response {resp}')
newrelic_logging.LoginException: sfdc token request failed. http-status-code:400, reason: {"error":"invalid_grant","error_description":"expired authorization code"}, full response <Response [400]>
2024-05-23 19:10:42,525 (15736/MainThread) newrelic.core.agent INFO - New Relic Python Agent Shutdown
NOTE: # ( Please provide specifics of the local error logs, Browser Dev Tools console, etc. if appropriate and possible. )
Your Environment
Additional context
The text was updated successfully, but these errors were encountered: