Salesforce API Testing with Username-Password Authentication

Expired Access/Refresh Token

After wasting frustrated time solving an auth issue, I wanted to post a quick note that some may find helpful: if you’re attempting to test your Salesforce API app against your sandbox instance and getting “expired access/refresh token” errors, make sure to append your sandbox name to the username. For example, if your username is:

jack@example.com

And your sandbox name is:

mysandbox

Make sure that when connecting to your sandbox instance, you change your username to:

jack@example.com.mysandbox

You’ll also need to change your endpoint to https://test.salesforce.com/services/oauth2/token, but you probably already knew that.

This information is in the documentation, but it’s buried at the bottom. I hope this helps you save a little time and hair pulling!

The following two tabs change content below.
Hi! My name is Jack and I would love to connect with you. I am a family man, an entrepreneur, a software developer, an API lover, and a clean energy pusher. I love meeting new people, and I'm here to help! Connect with me on Twitter, LinkedIn, or Google+.

Latest posts by Jack Jones (see all)

Tags: ,

No comments yet.

Leave a Reply