21

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?

  • 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 – TimChadwick Nov 25 '13 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!) – Vid L Nov 27 '13 at 12:46
11

In the UI - change API only user profile to another non-api only user profile. Log in, reset security token.

  • 1
    This answer is underrated! – Oles Malkov Mar 7 '16 at 15:29
  • Resetting a user's password through APEX e.g. System.setPassword('005240000110Axx', 'hello123'); does not refresh security token. Only by doing this through the UI as Dawid outlines does the security token get refreshed. – charliequinn Mar 2 '17 at 11:51
  • 1
    This sounds like an issue that SF needs to resolve! – Jorjani Aug 25 '17 at 17:26
4

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

  • 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? – Vid L Dec 18 '13 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.

0
  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

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.