oAuth - Error getting Token

Moderator: crythias

Post Reply
FHDENIT
Znuny newbie
Posts: 12
Joined: 16 Jun 2022, 08:12
Znuny Version: 6.4.2
Real Name: Frelsens Hær IT

oAuth - Error getting Token

Post by FHDENIT »

What are there missing ?


Backend ERROR: OTRS-CGI-70 Perl: 5.32.1 OS: linux Time: Thu Jun 16 06:52:49 2022

Message: Error requesting token for token config ID 1 with authorization code 'xxxxxxx: invalid_client.

RemoteAddress: 192.168.111.143
RequestURI: /otrs/get-oauth2-token-by-authorization-code.pl?code=xxxxxxxx&state=TokenConfigID1&session_state=yyyyyyyy

Traceback (3520):
Module: Kernel::Output::HTML::Layout::Error Line: 1037
Module: Kernel::Output::HTML::Layout::ErrorScreen Line: 1018
Module: Kernel::Modules::AdminOAuth2TokenManagement::_RequestTokenByAuthorizationCode Line: 120
Module: Kernel::Modules::AdminOAuth2TokenManagement::Run Line: 53
Module: Kernel::System::Web::InterfaceAgent::Run Line: 1144
Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_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
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: oAuth - Error getting Token

Post by root »

Hi,

Please check if the system configuration HttpType is set to https. The callback URL is generated out of the existing settings like HttpType, FQDN, etc., and if they are not well maintained, this could be the result.

- 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 ?
FHDENIT
Znuny newbie
Posts: 12
Joined: 16 Jun 2022, 08:12
Znuny Version: 6.4.2
Real Name: Frelsens Hær IT

Re: oAuth - Error getting Token

Post by FHDENIT »

Yes, HttpType is set to HTTPS
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: oAuth - Error getting Token

Post by root »

Hi,

Does the redirect URI you configured for your OAuth provider match the other sysconfig settings like FQDN and ScriptAlias? What is your provider?

- 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 ?
altinac
Znuny newbie
Posts: 9
Joined: 22 May 2014, 17:13
Znuny Version: 6.4.4
Real Name: Dave Ballard

Re: oAuth - Error getting Token

Post by altinac »

Roy,

I'm getting this same error, but I see the conversation ended with no response to your last question.

I've verified my HttpType is set to https and that my FQDN is correct. The part I'm wondering about is the ScriptAlias. Znuny has it set to otrs/. When I change the Azure Redirect URI to https://server address/otrs/ and click Request new token, the error goes away and I get:

The redirect URI 'https://server address/otrs/get-oauth2-token-by-authorization-code.pl' specified in the request does not match the redirect URIs configured for the application

When I set the Azure Redirect URI, I'm back to https://server address/otrs/get-oauth2-token-by-authorization-code.pl, the original invalid_client error that was from the original post. Any thoughts or suggestions on what could be the issue?
FHDENIT
Znuny newbie
Posts: 12
Joined: 16 Jun 2022, 08:12
Znuny Version: 6.4.2
Real Name: Frelsens Hær IT

Re: oAuth - Error getting Token

Post by FHDENIT »

I sadly can't remember what I changed, but suddenly it worked and sadly forgot this thread.
altinac
Znuny newbie
Posts: 9
Joined: 22 May 2014, 17:13
Znuny Version: 6.4.4
Real Name: Dave Ballard

Re: oAuth - Error getting Token

Post by altinac »

Any chance you have a sitebook with your configuration details of your server I can review? I might be able to find the part that is missing.

Thank you!
Dev1789
Znuny newbie
Posts: 2
Joined: 30 Jul 2023, 20:16
Znuny Version: Ce 6.0
Real Name: Devender singh

Re: oAuth - Error getting Token

Post by Dev1789 »

Backend ERROR: OTRS-CGI-16 Perl: 5.30.0 OS: linux Time: Sun Jul 30 17:33:21 2023

Message: Failed to get response for token request by authorization code for OAuth2 token configuration with ID 17.
Please someone can help me to resopve this
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: oAuth - Error getting Token

Post by root »

Dev1789 wrote: 31 Jul 2023, 08:10 Backend ERROR: OTRS-CGI-16 Perl: 5.30.0 OS: linux Time: Sun Jul 30 17:33:21 2023

Message: Failed to get response for token request by authorization code for OAuth2 token configuration with ID 17.
Please someone can help me to resopve this
Hi,

Please open a new post and add relevant log files.

- 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 ?
Post Reply