SugarCRM Mobile. How can I prevent our users to access using Sugar version

Hello!

We are developing a customized version of SugarCRM mobile and we would like to be able to force users to use this app, not the one Sugar provides us.

Is this possible?

thanks!!

Parents
  • Perhaps you can update in app.json the attribute jsConfig.clientID to some value other than "sugar".

    In the Sugar server side you can create a custom version of SugarOAuth2StorageMobile (custom/include/SugarOAuth2/SugarOAuth2StorageMobile) and override the method checkUserCredentials in order to evaluate if provided $client_id is "sugar", so you can refuse access.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André!

    I've been trying to test your solution.

    I've added one new record into oauth_consumer table. Here is where we place this client_id, right?

    But I couldn't find any client_id or clientID option into app.json (according to documentation), in fact I've looked for it in the project with no luck.

    Have you made this before? Do you know how to do it? any help would be really appreciated.

    Thanks!

  • After unpacking the sugar-mobile-sdk take a look at the folder sdk/config_template and open the file app.json. You will see all possible attributes you can configure on building a custom app.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks thanks thanks! Love that!

    Big kudo to you!

  • I created /custom/include/SugarOAuth2/SugarOAuth2StorageMobile.php in my instance:

    class sugarOAuth2StorageMobile extends SugarOAuth2StorageBase
    {
    public $numSessions = 2;

    public function checkUserCredentials(IOAuth2GrantUser $storage, $client_id, $username, $password)
    {

      if ($client_id === 'sugar') {
        throw new SugarApiExceptionNeedLogin('Please access through our custom app');
      }

      return parent::checkUserCredentials($storage, $client_id, $username, $password);
    }

    }

    Worked like a charm.

    Thanks!

Reply
  • I created /custom/include/SugarOAuth2/SugarOAuth2StorageMobile.php in my instance:

    class sugarOAuth2StorageMobile extends SugarOAuth2StorageBase
    {
    public $numSessions = 2;

    public function checkUserCredentials(IOAuth2GrantUser $storage, $client_id, $username, $password)
    {

      if ($client_id === 'sugar') {
        throw new SugarApiExceptionNeedLogin('Please access through our custom app');
      }

      return parent::checkUserCredentials($storage, $client_id, $username, $password);
    }

    }

    Worked like a charm.

    Thanks!

Children
No Data