function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
robert_clarkrobert_clark 

Inconsistency obtaining OAuth2 access tokens for different users

I have been exploring OAuth2/REST and have been partially successful.  Some user accounts can authorize but others can't.

I'm using the password flow and cURL to obtain an authorization token.  The method is outlined here : https://na1.salesforce.com/help/doc/en/remoteaccess_oauth_username_password_flow.htm

Here's an example the command, with ${..} style placeholders for sensitive info.

curl -d grant_type=password&client_id=$(my_client_id}&client_secret=${my_client_secret}&username=${username}&password=${password} https://login.salesforce.com/services/oauth2/token

When it works, it works great - I get back a token and can use it with subsequent REST queries etc.

When it fails (for most of the users) I get this JSON snippet:
{"error":"invalid_grant","error_description":"invalid user credentials"}

The steps to set up REST have all been followed, the users all have API Enabled.  For some users this always works, for others it never works.

Any help would be appreciated.

SuperfellSuperfell

For the failing attempts, what does login history show? are these users on sandbox servers (which require you to use a different url)

robert_clarkrobert_clark

For the successful logins it has:

Login type : Remote Access 2.0

Browser/Platform/Applcation : Unknown

 

For two of the failing users, failed login attempts do not show up at all.

 

For the third failing users, the failed login attempt shows up with status "Failed: Computer activiation required".

For this latter one, the cURL command does not return JSON but returns an HTML page including "<head><title>An internal server error has occurred</title></head>"

This latter one is self-explanatory but I am really after getting the other users working.

 

UPDATE - no these users are not on sandbox servers

 

Could there be any types of configurable login restrictions preventing access?

SuperfellSuperfell