You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2020-12-18 03:49:20

djmolletones
Member
Registered: 2019-04-05
Posts: 18

Plugin OAuth IMAP. Required parameter not passed: "refresh_token"

Hi,

I have a problem with the OAuth IMAP plugin, specifically with the Authorization it generates to establish the connection with the email account, in this case GMail. The point is that it works perfect, but the token it generates is only valid for 60 minutes, so it will be generating a new authorization so that it can continue working.

Do you know how to increase that time span, or how to make the token refresh automatically?

I appreciate the support.

Offline

#2 2021-01-22 12:33:21

Weastbug
Member
From: France
Registered: 2007-10-04
Posts: 68
Website

Re: Plugin OAuth IMAP. Required parameter not passed: "refresh_token"

Hi,

Same problem here for google too.

Oauth2 Autorisation Expiration is for 1 hour when created.

Collector work fine in this hour, after this i have a refresh token error. Need delete and recreate the authorisation again and reactive collector for have it working back.

Error wrote:

Adresse de courriel invalide
Une erreur est survenue en essayer de se connecter au collecteur.
Required parameter not passed: "refresh_token"


Based on my search and if i have understand GLPI Oauth need do the query with access_type=offline :

https://stackoverflow.com/questions/533 … ation-date
Due to security reasons, you cannot change the duration of the access token's expiry. However, you can refresh an access token without prompting the user for permission if you requested offline access to the scopes associated with the token.

  • If you use a Google API Client Library, the client object refreshes the access token as needed as long as you configure that object for offline access.

  • If you are not using a client library, you need to set the access_type HTTP query parameter to offline when redirecting the user to Google's OAuth 2.0 server. In that case, Google's authorization server returns a refresh token when you exchange an authorization code for an access token. Then, if the access token expires (or at any other time), you can use a refresh token to obtain a new access token.

Edit: the accessType in query was already set as offline..., don't understand all...

GLPI\marketplace\oauthimap\inc\application.class.php wrote:

         case Google::class:
            $params['accessType'] = 'offline';
            break;

Here sample of url on auth creation :

https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?scope=openid%20email%20profile%20https%3A%2F%2Fmail.google.com%2F&access_type=offline&state=xxxxxxxxxxx&response_type=code&redirect_uri=http%3A%2F%2Fxxxxxxxxxxx%2Fmarketplace%2Foauthimap%2Ffront%2Fauthorization.callback.php&client_id=xxxxxxxxxxx.apps.googleusercontent.com&flowName=GeneralOAuthFlow

Thanks in advance.

Last edited by Weastbug (2021-01-22 17:01:52)


GLPI 9.5.1 / IIS - Windows 2019 / PHP 7.4.1 / MySQL 5.7.31 / FusionInventory 9.5.0+1.0

Offline

#3 2021-01-26 17:34:08

Weastbug
Member
From: France
Registered: 2007-10-04
Posts: 68
Website

Re: Plugin OAuth IMAP. Required parameter not passed: "refresh_token"

This issue on plugin Oauth IMAP was reported on GitHub https://github.com/pluginsGLPI/oauthimap/issues/8


GLPI 9.5.1 / IIS - Windows 2019 / PHP 7.4.1 / MySQL 5.7.31 / FusionInventory 9.5.0+1.0

Offline

#4 2024-04-11 17:45:27

sIBajHYG
Member
From: Mission [KS]
Registered: 2023-08-18
Posts: 75

Re: Plugin OAuth IMAP. Required parameter not passed: "refresh_token"

Still relevant. Please tell me, are there any ways to make the receiver more stable?


Linux ubuntu-22.04.2-live-server-amd64, PHP 8.1.2, Apache 2.4.52, MariaDB 10.6.12, GLPI 10.0.15.
GLPI Inventory 1.3.5, PHP SAML 1.3.0,  Oauth IMAP 1.4.3, Additional Fields, 1.21.8,Ticket Cleaner.

Offline

Board footer

Powered by FluxBB