0

I'm working from https://developer.salesforce.com/page/Integrating_Java_Spring_Apps_on_Heroku_with_Force.com_REST_APIs

On the first day, I got everything to work with localhost, so if I opened http://localhost:8080/people/, then I would see the list of people. On the same day, I tried deploying to Heroku, but made a mistake with the environment variable values, so that didn't work.

On the next day, I realized what I had done wrong with the environment variable settings, fixed that, got past the initial error, and then got a 401 page with "HTTP Status 401 - Authentication Failed: OAuth login invalid or expired access token" from Apache Tomcat.

As a sanity check, I tried on localhost again and got the same 401 error page, even though everything had been fine on localhost before.

Finding nothing applicable by Googling, I finally tried deleting and re-creating the connected app for localhost from SalesForce, then putting the new Customer Key and Customer Secret values into the OAUTH_CLIENT_KEY and OAUTH_CLIENT_SECRET values in the run configuration to see if that would help.

After doing the above and re-visiting http://localhost:8080/people/, I got the page asking me to confirm allowing access, but then right back to the 401 page with "HTTP Status 401 - Authentication Failed: OAuth login invalid or expired access token" from Apache Tomcat.

Any idea what's wrong? Any idea how to diagnose what's wrong?

== EDIT ==

I also just tried to open the http://localhost:8080/people/ page in a private session in the browser. I had to log into SalesForce again in the private session, confirm my identity via email, etc., then finally got the same error yet again. So… this is apparently not an issue with data in a cookie.

1

It turns out the problem was that I had activated the "Require TLS 1.1 or higher for HTTPS connections" update in SalesForce, but the Java 1.7 Spring app was trying to connect using TLS 1.0, which is still the default in the Java 1.7 runtime libraries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.