[FIXED] OAuth2 redirect URI connection problem

Moderator: crythias

Post Reply
sebf
Znuny newbie
Posts: 5
Joined: 23 Apr 2024, 12:47
Znuny Version: 7.0.16
Real Name: Sebastian

[FIXED] OAuth2 redirect URI connection problem

Post by sebf »

Hello, I have problems when trying to get a token for OAuth2. I keep getting a pop-up as shown in the following image.
Screenshot 2024-04-24 091909.png
This comes along with the following error:

Backend ERROR: Znuny-CGI-27 Perl: 5.36.0 OS: linux Time: Tue Apr 23 09:12:06 2024

Message: Error assembling response data for token config with ID 1 and request type 'TokenByAuthorizationCode'.

RemoteAddress: x.x.x.x
RequestURI: /znuny/get-oauth2-token-by-authorization-code.pl?code= [...] state=TokenConfigID1&session_state=[...]

Traceback (641981):
Module: Kernel::System::OAuth2Token::RequestTokenByAuthorizationCode Line: 728
Module: Kernel::Modules::AdminOAuth2TokenManagement::_RequestTokenByAuthorizationCode Line: 107
Module: Kernel::Modules::AdminOAuth2TokenManagement::Run Line: 54
Module: Kernel::System::Web::InterfaceAgent::Run Line: 1091
Module: ModPerl::ROOT::ModPerl::Registry::opt_znuny_bin_cgi_2dbin_get_2doauth2_2dtoken_2dby_2dauthorization_2dcode_2epl::handler Line: 52
Module: (eval) (v1.99) Line: 207
Module: ModPerl::RegistryCooker::run (v1.99) Line: 207
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 173
Module: ModPerl::Registry::handler (v1.99) Line: 32


After a few seconds, I get the pop-up shown in the image below, but whenever I click on the "Reload page" button, regardless of what pop-up is, I still get the same problem.
Screenshot 2024-04-24 091844.png
I need this to be able to fetch the mailbox where tickets are received from customers. If it is possible, I am open to alternative methods other than OAuth2. The mailbox in question is on Outlook.

I would be very grateful for any kind of help.
You do not have the required permissions to view the files attached to this post.
Last edited by sebf on 29 Apr 2024, 14:34, edited 1 time in total.
root
Administrator
Posts: 3970
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: OAuth2 redirect URI connection problem

Post by root »

Hi,

Let's start with the basics:

1. Does the FQDN in the system configuration matches the on in the URL?
2. Same for HttpType?
3. Does the server has access to the internet?

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
sebf
Znuny newbie
Posts: 5
Joined: 23 Apr 2024, 12:47
Znuny Version: 7.0.16
Real Name: Sebastian

Re: OAuth2 redirect URI connection problem

Post by sebf »

Hello, Roy

The FQDN is set up correctly, matching the one inside the URL, the server has access to the internet and the HttpType is set on HTTPS.

Also, it is worth mentioning that the server is on a Debian 12 OS and it is installed on a VM
sebf
Znuny newbie
Posts: 5
Joined: 23 Apr 2024, 12:47
Znuny Version: 7.0.16
Real Name: Sebastian

Re: OAuth2 redirect URI connection problem

Post by sebf »

I have seen that in the request URI the HttpType and FQDN are missing, as seen in the error message. is it necessary to have them in the request URI?
root
Administrator
Posts: 3970
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: OAuth2 redirect URI connection problem

Post by root »

Hi,
The FQDN and HttpType are used to generate the callback URL, which has to match the one configured with the OAuth provider. The line in the code where this error happens is typically caused by a non-JSON response. There are many reason for this. E.g. a proxy is required and not correct setup, etc.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
sebf
Znuny newbie
Posts: 5
Joined: 23 Apr 2024, 12:47
Znuny Version: 7.0.16
Real Name: Sebastian

Re: OAuth2 redirect URI connection problem

Post by sebf »

Maybe the DNS has some problems as I was trying to run the command "apt update" and I get the error "Temporary failure resolving 'deb.debian.org'."
sebf
Znuny newbie
Posts: 5
Joined: 23 Apr 2024, 12:47
Znuny Version: 7.0.16
Real Name: Sebastian

Re: OAuth2 redirect URI connection problem

Post by sebf »

The problem was with the server's firewall. One of the rules was causing the problem as it was restricting access depending on IP address. Now I got the OAuth2 token and the login was succesful.
Post Reply