SuiteCRM integration NC Hub 20.0.7

Any direction is helpful. Just attempting to use the integration app SuiteCRM with NextCloud Hub. It’s a procedural issue not a bug I’m fairly sure. Just don’t have the knowledge to do this or maybe I cannot on a shared server??

Nextcloud version _ 20.0.7

Operating System: Linux 4.14.146-225.ELK.el6.x86_64 x86_64
CPU: Intel Core Processor (Skylake) (20 cores)
Memory: 57.59 GB

PHP
Version: 7.3.26
Memory Limit: -1 B
Max Execution Time: 3600
Upload max size: 356 MB

DB
Type: mysql
Version: 5.6.41
Size: 5 MB

The issue you are facing:
Attempting to integrate SuiteCRM with NextCloud Hub

Is this the first time you’ve seen this error? (Y/N):Y Not really an error just lack of understanding how to implement?

Steps to replicate it:

  1. Installed SuiteCRM App into an instance of NCHub 20.0.7 (https://ndl360life.com/nc21)
  2. Installed SuiteCRM into same shared host (https://www.ndl360life.com/scrm/index.php)
  3. Created OAuth client under “OAuth2 Clients and Tokens” in SuiteCRM and associated user
  4. copied ID and made “secret”; copied to NCHub admin settings… green checkmark
  5. attempt to connect with user “Connect Accounts” using name from associated user in SuiteCRM
  6. error 500 server not found

The output of your Nextcloud log in Admin > Logging:

Level
App	Message		Time
Warning	integration_suitecrm	SuiteCRM OAuth error : Server error: `POST https://www.ndl360life.com/scrm/Api/access_token` resulted in a `500 Internal Server Error` response		2021-02-07T11:39:24-0500
Warning	integration_suitecrm	SuiteCRM OAuth error : Server error: `POST https://www.ndl360life.com/scrm//Api/access_token` resulted in a `500 Internal Server Error` response

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'oc4gb715aci1',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'www.ndl360life.com',
    1 => 'ndl360life.com',
  ),
  'datadirectory' => '/home1/ndlthrsi/public_html/nc21/data',
  'dbtype' => 'mysql',
  'version' => '20.0.7.1',
  'overwrite.cli.url' => 'https://www.ndl360life.com/nc21',
  'dbname' => 'ndlthrsi_nc21',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ndlthrsi_ncad21',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'maintenance' => false,
  'updater.secret' => '$2y$10$EvdJBGrSdPvPZwMFzTVPb.l8x5/2U567o6Z3dfXwCmO4rLw52v2MS',
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:

??

I haven’t verified if a HTTP 500 error is generated if this hasn’t been done, but have you generated a public-private key pair to use for oauth as described here?: JSON API :: SuiteCRM Documentation

mwalbeck,

Thank you for your reply! Remember I’m on a shared host so I only have a cPanel.

I knew that was needed… but got lost about where and when to place!

Yes I did generate and authorized (attached screen shots), and I have access to download the private and public key. But, forgive me, at this point I’m ignorant as to where to update the APP and NextCloud. Do I need to install the OAuth of NextCloud?

I understand to necessity to link the two applications with encrypted keys, I just don’t have the procedure clear in my head and exactly where to place the information.

Thank you again for all assistance!

I was thinking that this is required in the NCHub installation (under settings, admin, security)?

The redirection would be the SuiteCRM url?

You don’t need to configure an OAuth client there you only need to connect the two applications under “Connected Accounts”.

The password client you configured in SuiteCRM needs to be used under Connected Accounts in the admin settings and then you use your normal username and password for SuiteCRM under Connected accounts in the personal settings.

The public and private keys need to be located here: /home1/ndlthrsi/public_html/scrm/Api/V8/OAuth2/

Having a closer look it seems like the mod_security apache module is blocking access. I don’t use apache myself so I’m not entirely sure what is needed but make sure this section is configured correctly, JSON API :: SuiteCRM Documentation especially since you have SuiteCRM in a subfolder, as that is generally not the default.

Interesting. Thank you again. I believe I have the correct information in the “Connected Accounts” fields.

Also I did find a file “gitignore” in “/home1/ndlthrsi/public_html/scrm/Api/V8/OAuth2/”.

Within are two lines:
private.key
public.key

Do I simply dump the keys text into this file?

I can’t find the ’ mod_rewrite’ but maybe this detail is found in the '.htaccess" file. I’ll keep looking, but, I keep running into document default expectations that do not fit my environment.

It would be wonderful if someone could write a procedure based on the type of server used; or provide an APP that walks thru the process to link NCHub with 'Integrations".

Anyway, thank you again. I’d like to integrate SuiteCRM into NCHub but it seems beyond my capabilities. My workaround is to load the SuiteCRM into an “External Site” via the NCHub “External Site App”. It is nice the SuiteCRM loads into the same tab, and I need to log into SuiteCRM for each session, but, it works. I’m not sure what else I’m missing by not having the “connected Account” token.

I appreciate any other ideas!!!

Also, why is it not possible to create “SuiteCRM” as an APP within NCHub? Are there license issues?

I would be happy with the disk space. It seems this would be pleasant for anyone who does not have an existing instance of SuiteCRM that needs to be integrated.

Maybe simply make it an option during install of NCHub?

The private and public key just need to be placed in that folder, not in the .gitignore file.

I would assume most shared hosts have mod_rewrite enabled but you can try some of the suggestions from the stack overflow links they referenced in the documentation.

I believe you may need to just add that section mentioned in the SuiteCRM docs to the .htaccess file in the root of your SuiteCRM install. Of course with the <Directory /var/www/subdir> pointing to the path of your SuiteCRM install so that line would be <Directory /home1/ndlthrsi/public_html/scrm>.

I do think it’s possible but I doubt it would be easy as SuiteCRM is quite a big and complex application. I think the integration is a good alternative, even though the oauth setup on the SuiteCRM side may not be the most beginner friendly.

OK. When you write “the keys need to be in the folder”… you mean make a text file for each, paste the key, and somehow reference the file name?

I’ll review the stack overflow again.

Thanks!

Yes, place the public key in a file called “public.key” and the private key in a file called “private.key” in that folder. You don’t need to reference them, SuiteCRM will automatically pick them up.

Excellent. Thank you.

I will experiment. If I get it working I’ll document for others on a shared host platform.

I managed setting up ( I think)
when cliking on connect, I get a javascript install requirement in notification, even if browser supports javascript

I simply cannot connect. Would somebody please review the following and tell me where I’m going wrong?

SuiteCRM:

  • I’ve created an OAuth2 Client in SuiteCRM called “MySuiteCRM”
  • The ID of the client was auto-populated.
  • The secret is a newest one which I created in the Change Secret field after selecting “Edit”

Nextcloud:

  • at Admin > Connected accounts, I have the correct URL to my SuiteCRM instance
  • I’m using “MySuiteCRM” as the Application ID
  • the Application Secret is that which was created above
  • at Personal > Connected accounts, I’m using my actual SuiteCRM login details

As a result of the above, I continue to be stymied by “Failed: Invalid login/password”

Furthermore:

  • I have a public and a private key at …/Api/V8/OAuth2/
  • I’ve tried using the SuiteCRM Client ID (rather than the name) as the Application ID in Nextcloud
  • I’ve restarted apache after each change

At my last attempt, the access log shows:

96.127.239.2 - - [22/Feb/2021:16:37:45 -0500] "POST //Api/access_token HTTP/1.1" 404 882
96.127.239.2 - - [22/Feb/2021:16:38:06 -0500] "GET /index.php?module=Alerts&action=get&to_pdf=1 HTTP/1.1" 200 1462

This is correct. You should use the ID not the name.

The rest of the steps look correct.

Looking at this entry there is an extra / in //Api/access_token. In Admin > Connected accounts does the URL for your SuiteCRM instance end with a /? If yes, then you should remove it.

1 Like

WOW, @mwalbeck, that did it !!! I’m in! :grin: :clap:

Thank-you so very much!

1 Like

Hi Guys,
I’ve try witht the latest NC to integrate suiteCRM as explain above by @Hevii_Guy and @mwalbeck but i keep getting the error message:



This application requires JavaScript for correct operation. Please enable JavaScript and reload the page.

Internal Server Error
The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.

Technical details
Remote Address: xx.xxx.xxx.xxx
Request ID: xxxxxxxxxxxxxxxx

would be great to get help.

thanks