MarcelRobitaille / nextcloud_google_synchronization

🇬 Google integration into Nextcloud
GNU Affero General Public License v3.0
21 stars 2 forks source link

401 error from google #18

Open CybSecUK opened 5 months ago

CybSecUK commented 5 months ago

Which version of synchronization_google are you using?

Latest ( sorry away from machine)

Which version of Nextcloud are you using?

Hub8

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Chrome up to date and checked with Firefox

Describe the Bug

Failed to get number of Google contacts: Request failed with status code 401 connected to app, authorised all ok, get this error when telling app to sync from admin area of nc

Expected Behavior

Google acc sync

To Reproduce

Follow instructions in app doc

MarcelRobitaille commented 5 months ago

Hi @CybSecUK. Thanks for reporting. Could you please send a screenshot of where you see the 401 error? Could you please also share your server logs? You can go to settings > Logging > 3-dot menu > Download logs. This will be impossible to diagnose without logs.

CybSecUK commented 5 months ago

[image: Google sync 401-1.PNG] Hi, hope this is what you need its a new NC install, so I may have missed something Stubbsy

On Fri, 7 Jun 2024 at 18:33, Marcel Robitaille @.***> wrote:

Hi @CybSecUK https://github.com/CybSecUK. Thanks for reporting. Could you please send a screenshot of where you see the 401 error? Could you please also share your server logs? You can go to settings > Logging > 3-dot menu > Download logs. This will be impossible to diagnose without logs.

— Reply to this email directly, view it on GitHub https://github.com/MarcelRobitaille/nextcloud_google_synchronization/issues/18#issuecomment-2155251026, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CJOPO7AEANVH7KJ553T3LZGHVF7AVCNFSM6AAAAABI7BHFW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGI2TCMBSGY . You are receiving this because you were mentioned.Message ID: <MarcelRobitaille/nextcloud_google_synchronization/issues/18/2155251026@ github.com>

CybSecUK commented 5 months ago

Hi, any ideas ? Stubbsy

On Fri, 7 Jun 2024 at 18:50, Cyb Sec @.***> wrote:

[image: Google sync 401-1.PNG] Hi, hope this is what you need its a new NC install, so I may have missed something Stubbsy

On Fri, 7 Jun 2024 at 18:33, Marcel Robitaille @.***> wrote:

Hi @CybSecUK https://github.com/CybSecUK. Thanks for reporting. Could you please send a screenshot of where you see the 401 error? Could you please also share your server logs? You can go to settings > Logging > 3-dot menu > Download logs. This will be impossible to diagnose without logs.

— Reply to this email directly, view it on GitHub https://github.com/MarcelRobitaille/nextcloud_google_synchronization/issues/18#issuecomment-2155251026, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CJOPO7AEANVH7KJ553T3LZGHVF7AVCNFSM6AAAAABI7BHFW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGI2TCMBSGY . You are receiving this because you were mentioned.Message ID: <MarcelRobitaille/nextcloud_google_synchronization/issues/18/2155251026@ github.com>

MarcelRobitaille commented 5 months ago

The image did not send correctly. This is all I see in GitHub. image

CybSecUK commented 5 months ago

Please aee attached, the other email didnt get through, removed and readded, still getting the 401 error

On Fri, 7 Jun 2024 at 18:33, Marcel Robitaille @.***> wrote:

Hi @CybSecUK https://github.com/CybSecUK. Thanks for reporting. Could you please send a screenshot of where you see the 401 error? Could you please also share your server logs? You can go to settings > Logging > 3-dot menu > Download logs. This will be impossible to diagnose without logs.

— Reply to this email directly, view it on GitHub https://github.com/MarcelRobitaille/nextcloud_google_synchronization/issues/18#issuecomment-2155251026, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CJOPO7AEANVH7KJ553T3LZGHVF7AVCNFSM6AAAAABI7BHFW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGI2TCMBSGY . You are receiving this because you were mentioned.Message ID: <MarcelRobitaille/nextcloud_google_synchronization/issues/18/2155251026@ github.com>

MarcelRobitaille commented 5 months ago

There is still nothing attached. Please comment on GitHub instead of using email. It is not working.

CybSecUK commented 5 months ago

Hi, hopefully, these are attached nextcloudLOG.zip 401error_Gsync_NC

urbaman commented 5 months ago

Hi, having the very same problem, any solution?

MarcelRobitaille commented 5 months ago

@CybSecUK Thank you for sending the image. I know that there are error messages. Could you please send some logs as described before?

Could you please also share your server logs? You can go to settings > Logging > 3-dot menu > Download logs. This will be impossible to diagnose without logs.

CybSecUK commented 5 months ago

The logs were in the zip file ?

Paul Stubbs | CybSec

On Wed, 19 Jun 2024 at 20:48, Marcel Robitaille @.***> wrote:

@CybSecUK https://github.com/CybSecUK Thank you for sending the image. I know that there are error messages. Could you please send some logs as described before?

Could you please also share your server logs? You can go to settings > Logging > 3-dot menu > Download logs. This will be impossible to diagnose without logs.

— Reply to this email directly, view it on GitHub https://github.com/MarcelRobitaille/nextcloud_google_synchronization/issues/18#issuecomment-2179376319, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CJOPL2UBFWURYPNG2AQKTZIHOCNAVCNFSM6AAAAABI7BHFW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZZGM3TMMZRHE . You are receiving this because you were mentioned.Message ID: <MarcelRobitaille/nextcloud_google_synchronization/issues/18/2179376319@ github.com>

MarcelRobitaille commented 5 months ago

@CybSecUK Sorry I missed that link. I will take a look.

CybSecUK commented 5 months ago

Hi, just wondered if any update ?

MarcelRobitaille commented 4 months ago

Hi @CybSecUK

I looked through the log file you attached and I did not see any mention of this app. Must be a purely fronend issue. I should add some better error reporting for these errors.

I just tried to reproduce the error in a fresh development docker container and I was not able to. Everything worked perfectly.

Steps to NOT reproduce:

  1. https://github.com/juliushaertl/nextcloud-docker-dev?tab=readme-ov-file#standalone-containers
  2. Copied standalone command: docker run --rm -p 8080:80 ghcr.io/juliushaertl/nextcloud-dev-php80:latest (changed 80 to 81)
  3. Navigated to localhost:8080
  4. Installed the latest integration google app version
  5. Followed the instructions in the connected accounts page
  6. Pressed login in the data migration page

Some steps for you to try:

  1. Please try my steps above and let me know if that works for you
  2. Please double check that you followed all the steps in the connected accounts page exactly. Maybe you forgot to add the redirect url?
MarcelRobitaille commented 4 months ago

Please try the newly released version 2.2.0. I have made some improvements to the frontend error reporting.

urbaman commented 4 months ago

Tryed 2.2.1:

Detail: { "message": "Request failed with status code 401", "name": "AxiosError", "code": "ERR_BAD_REQUEST", "config": {} }

MarcelRobitaille commented 4 months ago

@urbaman Thank you for testing that. Unfortunately that doesn't give me any more information. I really hate Google's apis. They always fail without telling you why.

Did you try the steps described in my comment _above?

There may be more information in the browser developer tools. Can you please press ctrl+shift+i and then press console. You should see something red printed saying something about the 401 error. Then, please go to the network tab and look for a request that fails with error 401. Click the request and check the response.

mjkl-gh commented 3 months ago

I also encountered this error. Turned out I forgot to enable all the api's for my project (reused an existing one)

Found this in the console error:

People API has not been used in project REDACTED before or it is dis (truncated...)
CybSecUK commented 3 months ago

I’ll check again but pretty sure they all were enabled New project etc

On Sun, 4 Aug 2024 at 15:23, Maarten @.***> wrote:

I also encountered this error. Turned out I forgot to enable all the api's for my project (reused an existing one)

Found this in the console error:

People API has not been used in project REDACTED before or it is dis (truncated...)

— Reply to this email directly, view it on GitHub https://github.com/MarcelRobitaille/nextcloud_google_synchronization/issues/18#issuecomment-2267561690, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CJOPO4OKO24CGS7NUZJ3LZPY2PRAVCNFSM6AAAAABI7BHFW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRXGU3DCNRZGA . You are receiving this because you were mentioned.Message ID: <MarcelRobitaille/nextcloud_google_synchronization/issues/18/2267561690@ github.com>

CvH commented 3 months ago

I run into the same problem, not sure but is it maybe related that the redirect uri is not public (from the internet) accessible? Is that a requirement that the app should work or is it not a problem ?

MarcelRobitaille commented 3 months ago

@CvH That should not be a problem. It should work with localhost.

kblock1 commented 2 months ago

There is another step that needs to happen with the google API:

From the dashboard, ensure that in "Enabled APIs and services" you have actually enabled the Google Drive API for your application.

Ullulaki commented 1 month ago

There is another step that needs to happen with the google API:

From the dashboard, ensure that in "Enabled APIs and services" you have actually enabled the Google Drive API for your application.

Faced the same problem with 401 and thanks to your comment I managed to fix it. Indeed it is as you said: you need to activate the API for each of the services you wanna use (in my case only google calendar was needed).

If, like me, you only want to use the calendar function, only activate calendar api and when logging in via nextcloud into google only grant the calendar rights -> no errors!

If anyone needs the corresponding links (just make sure, you choose your own correct project before activating: Google Drive: https://console.cloud.google.com/apis/library/drive.googleapis.com Google Calendar: https://console.cloud.google.com/apis/library/calendar-json.googleapis.com Google Fotos: https://console.cloud.google.com/apis/library/photoslibrary.googleapis.com (not exactly sure) Google Contacts: https://console.cloud.google.com/apis/library/contacts.googleapis.com