Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not request access token for. The refresh token could be expired or invali #3

Open
tobiasmith opened this issue Aug 8, 2022 · 3 comments · May be fixed by #5
Open

Could not request access token for. The refresh token could be expired or invali #3

tobiasmith opened this issue Aug 8, 2022 · 3 comments · May be fixed by #5

Comments

@tobiasmith
Copy link

Hi, once I set OAUTH2 for Exchange Online Mail account in OTOBO, downloading emails will stop with error as bellow. After edit and save mail account and login to Microsoft, error will stop for next hour. In the auth_token table will be a new refresh key with every "edit and save mail account"

Backend ERROR: OTOBO-CGI-00 Perl: 5.32.1 OS: linux Time: Thu Jun 30 17:28:34 2022

Message: CommunicationLog(ID:126465,AccountType:-,AccountID:-,Direction:Incoming,Transport:Email,ObjectLogType:Connection,ObjectLogID:187362)::Kernel::System::MailAccount::POP3 => POP3OAuth2: Could not request access token for XXXX‘. The refresh token could be expired or invalid.

RemoteAddress:
RequestURI: /otobo/index.pl?Action=AdminMailAccount;Subaction=Run;ID=2;ChallengeToken=XXXXX;
Punamu added a commit to Punamu/MailAccount-OAuth2 that referenced this issue Aug 22, 2022
Fixes RotherOSS#3

Removed the `LOWER` SQL functions which prevented an OAuth2 access_token
refresh using the refresh_token stored in the database.
Punamu added a commit to Punamu/MailAccount-OAuth2 that referenced this issue Aug 22, 2022
Fixes RotherOSS#3

Removed the `LOWER` SQL functions which prevented an OAuth2 access_token
refresh using the refresh_token stored in the database.
@Punamu Punamu linked a pull request Aug 22, 2022 that will close this issue
@Punamu
Copy link

Punamu commented Oct 15, 2024

@stefanhaerter Sorry to mention you directly, but since this issue is now open for 2 years is there any chance this could be looked at?

The linked PR fixed the issue for us. As of right now we have to alter the code manually after every update.

@stefanhaerter
Copy link
Contributor

The mention is fine, don't worry - this will definitely been looked at, but as I'm not familiar with Outlook / Exchange at all, I can't give any estimate about this. Your PR looks like a sensible change, but usually we try to make an effort to understand why the code causing the failure was implemented and which possible side effects are to be considered.

I'll provide an update as soon as we have the capacity to review this.

@Punamu
Copy link

Punamu commented Oct 15, 2024

Thanks for the update!

I can't answer the "why" but there are some inconsistencies in the code regarding access of the account_type column.
Maybe this helps to speed up the analysis.

The insert happens without a LOWER:

SQL => "INSERT INTO $Self->{TokenTable} (token, account_type, account_id, token_type) "
. "VALUES (?, ?, ?, 'refresh')",

Also these deletes don't have a LOWER either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants