I am using VBA to get authorization in Salesforce and then ultimately want to run a Salesforce report and dump the results in Excel. I have written the following to handle the a
You're using "Username-password flow". All params in the URL, without displaying a popup letting user type his credentials straight to SF (ideally if there's user interaction rather than backend systems talking to each other you're supposed to use another OAuth flow so your app doesn't handle passwords, can't leak them).
Troubleshooting:
username
in your request is encoded. At very least put %40
instead of @
. If your attempt doesn't even show up in user's login history - wrong / incorrectly encoded username.login.salesforce.com
. Maybe your organisation disabled it and allows only the branded login domain (will impact API access too). Or maybe your admins allow logging in only from certain IPs...Authorization: Basic
+ username & pass in this call, you pass it in POST's payload and that's enough.If you have Postman, curl, SoapUI or any client like that - might help before jumping straight to VBA?
This works for me (with Content-Type: application/x-www-form-urlencoded
header)