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 2022-09-13 10:16:51

Obrian
Member
Registered: 2018-10-31
Posts: 9

Oauth for O365 - Error when creating an authorization

Hi All,

I have an issue trying to use the Oauth plugin in my GLPI to collect email from my O365 mailbox.
I've already successfully done the same process to another GLPI server couple of years ago, but this time , on a new server, it seems something is wrong.

I did follow lots of guide, and here is what I 've done so far, and  the error I got. (I did follow that guide for instance : https://forum.glpi-project.org/viewtopic.php?id=284562 )

- I'm using a debian linux server for GLPI (v 10.0.2), and add the plugin Oauth (v1.4.1) by the market place
- So the app is registered in my Azure Portal.
- I put the app Client ID and Tenant ID to my OAUTH glpi plugin.
- I've created a secret on my azure app, and added the value to my Oauth entry as well.

Ten when I click on "create an authorisation", I put the o365 credential of the mailbox I would like to collect, password. But then it send my back to glpi with this error :
" Unable to save authorization code"
The php log gives :

glpiphplog.WARNING:   *** PHP User Warning (512): Error during authorization code fetching: Expired token in /var/www/html/glpi/marketplace/oauthimap/inc/authorization.class.php at line 425

I've tried to change the callback url to be https / http with localhost .... but I stil have the same result. I also create a new secret, and put the new value in the Oauth plugin , still the same.

I would really appreciate if you can point me to the right direction , to sort this out.
Thank you

Offline

#2 2022-09-26 14:10:11

Obrian
Member
Registered: 2018-10-31
Posts: 9

Re: Oauth for O365 - Error when creating an authorization

Hi ,
I'm wondering if someone has any clue to fix that ?
Thank you.

Offline

#3 2022-09-26 20:56:16

eric.le-corre
Member
Registered: 2013-01-07
Posts: 1,005

Re: Oauth for O365 - Error when creating an authorization

did you pass the command on the plugin folder :
chown -R www-data:www-data oauthimap
chmod -R 755 oauthimap

Last edited by eric.le-corre (2022-09-26 21:04:27)

Offline

#4 2022-10-13 18:42:49

coolcrash
Member
Registered: 2020-10-23
Posts: 3

Re: Oauth for O365 - Error when creating an authorization

this is always the same crap, stupid answers do you think we haven't tried the permissions yet?
clearly this is a bug on this plugin not working with oAth on O365

Offline

#5 2022-11-08 15:41:02

elprimo
Member
Registered: 2022-11-08
Posts: 8

Re: Oauth for O365 - Error when creating an authorization

Hey, did you find a solution of the bug ? I receive the same message <Unable to save authorization code> while creating an authorisation for oauth IMAP plugin.

coolcrash wrote:

this is always the same crap, stupid answers do you think we haven't tried the permissions yet?
clearly this is a bug on this plugin not working with oAth on O365

Offline

#6 2022-11-10 04:05:50

Animation4
Member
Registered: 2022-11-10
Posts: 1

Re: Oauth for O365 - Error when creating an authorization

Came across the problem today. Here is my experience and what worked for me. YMMV (Your Mileage May Vary).

I use Office 365 Business.

- Converted Shared Account to MailBox User (Yes, I had to pay for this unfortunately)
- Removed and Recreated my App Registration (Done in Azure Portal / Active Directory)
- Removed and Recreated my API Permissions associated with my App Registration

After above I was able to add new OAUTH IMAP Provider and Oauth authorization successfully.

Hope this helps.

Offline

#7 2024-09-27 09:14:13

ivene
Member
Registered: 2024-09-27
Posts: 1

Re: Oauth for O365 - Error when creating an authorization

Anybody still having issues on this? I'm on 10.0.16 and yet get the same issue using marketplace plugin of OAuth.

Offline

#8 2024-10-13 05:38:33

leafmatrix
Member
Registered: 2024-10-13
Posts: 2

Re: Oauth for O365 - Error when creating an authorization

Same. On 10.0.16. Also looking for fix. Tried removing/reinstalling plugin. Same issue.

Offline

#9 2024-10-13 05:51:01

leafmatrix
Member
Registered: 2024-10-13
Posts: 2

Re: Oauth for O365 - Error when creating an authorization

Solved the issue. Check your logs. Try the following. Open a terminal windows and change to your "glpi" folder. For example:

$ tail -F public_html/glpi/files/_log/php-errors.log

1. Create new OAUTH Authorization. If it fails, check the logs for a clue. For example, I was getting the below:
---
[2024-10-13 03:40:23] glpiphplog.WARNING:   *** PHP User Warning (512): Error during authorization code fetching: invalid_client
AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app 'XXX'. Trace ID: YYY Correlation ID: ZZZ Timestamp: 2024-10-13 03:40:23Z in /home/USER/glpi-10.0.16/marketplace/oauthimap/inc/authorization.class.php at line 425
  Backtrace :
  ...place/oauthimap/inc/authorization.class.php:425 trigger_error()
  ...e/oauthimap/front/authorization.callback.php:77 PluginOauthimapAuthorization->createFromCode()
---

In my case I was using the wrong client secret. Once I updated the correct client_secret I was able to authorize successfully. Hope this helps anyone.

Offline

#10 2024-11-14 01:05:45

glpi-enduser
Member
Registered: 2018-07-31
Posts: 12

Re: Oauth for O365 - Error when creating an authorization

I have a similar issue and cannot create authorization.

[2024-11-14 08:19:16] glpiphplog.WARNING:   *** PHP User Warning (512): Error during authorization code fetching: Expired token in /var/www/html/marketplace/oauthimap/inc/authorization.class.php at line 423
  Backtrace :
  ...place/oauthimap/inc/authorization.class.php:423 trigger_error()
  ...e/oauthimap/front/authorization.callback.php:77 PluginOauthimapAuthorization->createFromCode()
  public/index.php:82                                require()
  

Offline

Board footer

Powered by FluxBB