How can I create OAuth token for the particular user

How can I create OAuth keys for a particular user ? Please help me to find a solution to create OAuth key for an particular user

  • This POST call returns access_token & refresh_token against a valid username & password

    {{sugar_url}}/rest/v11_4/oauth2/token?platform=base&username={{username}}&password={{password}}&grant_type=password&client_id=sugar
  • Hi Sino Thomas,

    You can create the OAuth key by Admin->OAuth Key.

    After creating it you can use it for your user for which you want to use and pass the following arguments for authentication.


    $oauth2_token_arguments = array(
    "grant_type" => "password",
    //client id - default is sugar.
    //It is recommended to create your own in Admin > OAuth Keys
    "client_id" => "sugar",
    "client_secret" => "",
    "username" => $username,
    "password" => $password,
    //platform type - default is base.
    //It is recommend to change the platform to a custom name such as "custom_api" to avoid authentication conflicts.
    "platform" => "custom_api"
    );

  • Hello , I am dealing with the same issue, however I have no option to create a key in OAuth Key Menu. What would you suggest to do in this case? 

  • If you are looking for a "long term auth token", sugar does not have this.

    if you try to integrate a tool that does not handle sugar auth, I recommend you to build a custom entry point with "noLoginRequired" and implement your own security check. (ensure to set the current_user before doing any db call)

    NB: Sugar teams is currently trying to see if they can remove this option, I doubt it will be in a near future since they don't provide any other standard way to secure WS integrations.
  • I put in an enhancement request some years ago to allow unlicensed "integration" users to be added to the credentials:
    https://portal.sugarondemand.com/#supp_Bugs/99cd9082-fe76-11e6-b0b3-d4bed9b70c64
    Then you could set a "platform" for each of your integration applications.

    So far it counts 15 customers affected, if you submit a Case to Support and ask to be added to the "Affected Customers" for Idea #78363 maybe we'll get what we need Slight smile

  • Hi  ,

    There is an option to create OAuth keys in the module-level menu:

    If you don't see that option, what version of Sugar are you running?

    Chris