uvdesk / core-framework

UVDesk Community Helpdesk Core Framework Bundle providing the core essential functionalities and integration tools to easily integrate any other community helpdesk packages.
https://www.uvdesk.com
MIT License
60 stars 53 forks source link

Uvdesk Microsoft Apps configuration error #698

Open tsxsys opened 12 months ago

tsxsys commented 12 months ago

Hi All, I have install Opensource UVdesk version 1.2 running on Linux Plesk server but I cannot get the email from the O365 as ticket in my UVdesk. I have tried to Integrate Microsoft App to my Opensource UVdesk using these steps How To Integrate Microsoft App to your Opensource UVdesk on completion I get

Microsoft app settings could not be verified successfully. Please check your settings and try again later.

image

Please guide me what can I do for this.

komal-sh-27 commented 12 months ago

@tsxsys ,

If you're getting this error, it means that the app wasn't able to successfully retrieve the access token. In order to debug what went wrong, could please the make the following changes as well:

File Path:

project/vendor/uvdesk/core-framework/Services/MicrosoftIntegration.php

Add the following lines of code at line #61 (I've attached a screenshot for reference):

dump($accessCode);
dump($curlResponse);
dump($jsonResponse);
die;

image

After making the following changes, go ahead and try setting up/verifying the app again. You'll be taken to microsoft login for authenticating the request, and then redirected back to your helpdesk and the access token response will be dumped.

In case of any errors, this will let us know what went wrong during authentication and we can then further suggest to resolutions accordingly. Also, please share your screenshots.

tsxsys commented 12 months ago

@Komal-sharma-2712

I have errors here

MicrosoftIntegration.php on line 63: array:6 [▼ "error" => "invalid_client" "error_description" => """ AADSTS500112: The reply address 'httpss://localuvdesk.com/skeleton/public/en/admin/integrations/microsoft-apps/oauth/login' does not match the reply address 'ht ▶ Trace ID: xxxxxxxx Correlation ID: xxxxxxxx Timestamp: 2023-10-10 15:27:39Z """ "error_codes" => array:1 [▼ 0 => 500112 ] "timestamp" => "2023-10-10 15:27:39Z" "trace_id" => "xxxxxxx" "correlation_id" => "xxxxxxxx" ]

I can see httpss but I input https in the 365 I don't know if that could be an issue?

Any update on this yet?

komal-sh-27 commented 11 months ago

@tsxsys ,

Thanks for the updated here. Let us know, your project installed on server or live, because for using microsoft app option your project should be on live or server.

For this error once you will be change some code on your project, please follow the below steps:

MicrosoftIntegration.php on line 63: array:6 [▼ "error" => "invalid_client" "error_description" => """ AADSTS500112: The reply address 'httpss://localuvdesk.com/skeleton/public/en/admin/integrations/microsoft-apps/oauth/login' does not match the reply address 'ht ▶

Step 1: Go to your project, open the 'MicrosoftApps.php' file under your project follow the below path:

vendor/uvdesk/core-framework/Controller/MicrosoftApps.php

Now change the below this line no. on 149:

$redirectEndpoint = str_replace('http', 'https', $this->generateUrl('uvdesk_member_core_framework_integrations_microsoft_apps_oauth_login', [], UrlGeneratorInterface::ABSOLUTE_URL));

to

$redirectEndpoint = str_replace('http://', 'https://', $this->generateUrl('uvdesk_member_core_framework_integrations_microsoft_apps_oauth_login', [], UrlGeneratorInterface::ABSOLUTE_URL));

image

Step 2: After saved this line then clear cache of your project using the below command:

$ php bin/console c:c

Please make a try with these changes and check again showing any error or not.

tsxsys commented 11 months ago

Hi @Komal-sharma-2712

Mailbox connected now but not fetching emails in UVdesk I get this error when I run

$ php bin/console c:c $ php bin/console uvdesk:refresh-mailbox hd@tssys.uk

ERROR Failed to connect to localhost port 8000 after 0 ms: Connection refused

image

Please guide me what can I do for this to work?

komal-sh-27 commented 11 months ago

Hello @tsxsys ,

Thanks for the updated here. As per shared your screenshots, in your project site url is not correct. Please save the email settings of your project. Also, once you set the correct site url in your project. Please follow the below steps.

Step 1: Open your project and go to the uvdesk.yaml file under your project. Follow the below file path:

your-project/config/packages/uvdesk.yaml

image

Step 2: After saved site url then clear cache of your project using the below command:

$ php bin/console c:c

Please make a try with these changes and check again with refresh mailbox command showing any error or not.

tsxsys commented 11 months ago

Thanks for the quick response. I have made those changes but get this error image

komal-sh-27 commented 11 months ago

@tsxsys ,

Once you check again your site url is correct or not. Because here error shows port 80. Please check it once again. Let us know, you are using your project on localhost or docker.

tsxsys commented 11 months ago

@Komal-sharma-2712

It's on localhost on a cloud live server.

Do I have to put a domainname.com for the site url or localhost is okay?

I have SSL installed for the domain how can I change the port if it's running http to https?

komal-sh-27 commented 11 months ago

@tsxsys,

Do I have to put a domainname.com for the site url or localhost is okay?

Yes, you can add with the localhost domain name.

I have SSL installed for the domain how can I change the port if it's running http to https?

For this you can contact with your web server assistant.