25

API only users cannot login and choose 'Reset my security token'. Right now, in my company, we select a System Administrator profile for users, log in for the first time, choose 'Reset my security token', then change the profile to a custom profile which has API only enabled.

The other way of doing it is, modifying the profile to not have API only user checked initially and then turn it on once the security token is received.

Is there a recommend way to do this? Is there an option to force the security token to be sent when the user is created with a profile which has API user enabled?

2
  • I am unsure what you want here, Are you asking if there is a way to not use security tokens / turn them off? If that is what you are asking yes, you can change your Login IP Range. This will let you Login and do API calls without needing the token. You can also make it so System Admin has API Only turned on when you deploy your code Nov 25, 2013 at 14:49
  • @TimChadwick I'm asking how do I access the 'Reset Security Token' option for users with API Only on their profiles. (That's so much simpler!)
    – LVS
    Nov 27, 2013 at 12:46

4 Answers 4

16

In the UI - change API only user profile to another non-api only user profile. Log in, reset security token. The IP range(s) on the profile assigned to the non-API User must allow your IP or you will not see the 'Reset Security Token' option on the User record.

1
  • Even in 2023, this seems to be the way to do this. Mar 28 at 9:31
9
  1. Use the Log In as Another User feature to log as the 'API Only' user

login_as_api_user


  1. Reset the security token while logged in as the 'API Only' user

reset_token_while_logged_in_as_api_user

1
  • Thats neat but also kind of weird. Is the fact that "Login as" works with "API Only" users a feature or a bug?
    – codeulike
    May 26, 2022 at 10:18
5

You could try changing the users password.

From Security and the API (my emphasis):

Users can obtain their security token by changing their password or resetting their security token via the Salesforce user interface. When a user changes their password or resets their security token, Salesforce sends a new security token to the email address on the user’s Salesforce record. The security token is valid until a user resets their security token, changes their password, or has their password reset.

One way to change the password would be to use the setPassword() Partner API method from another valid API user.

UPDATE: It appears that the setPassword() method is insufficient to trigger sending the security token. Instead, see Dewid's answer.

Additionally, consider voting for the idea: Give the ability to change API Only User security token

1
  • 3
    A security token is sent on password resets only if it's received the first time through the UI option. Is that not so?
    – LVS
    Dec 18, 2013 at 18:00
0

We are following the below steps. 1. Created a Custom Profile named 'API only' (API permission is enable). 2. Resetting the password from the UI or you may use Apex script if don't want to send any email to the API only user. 3. Use 'Login As' button from the User created above --> Go to My Settings from the User icon. 4. Reset the Security Token, an email will be sent to the User email ID. 5. log off.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .