*

Vlad7

  • ****
  • 244 posts
Hello. Today I found a problem with user login. User gets ERROR500 page when using Google Login Osclass Plugin and PWA Osclass Plugin together. We get an error:

[05-Jul-2022 19:33:41 Europe/Kiev] PHP Fatal error:  Uncaught Google_AuthException: Error fetching OAuth2 access token, message: 'invalid_grant' in /home2/ukagroco/public_html/oc-content/plugins/google_login/src/auth/Google_OAuth2.php:112
Stack trace:
#0 /home2/ukagroco/public_html/oc-content/plugins/google_login/src/Google_Client.php(131): Google_OAuth2->authenticate(Array, '4/0AX4XgWhdxnKC...')
#1 /home2/ukagroco/public_html/oc-content/plugins/google_login/index.php(52): Google_Client->authenticate('4/0AX4XgWhdxnKC...')
#2 /home2/ukagroco/public_html/oc-includes/osclass/classes/Plugins.php(42): ggl_callback()
#3 /home2/ukagroco/public_html/oc-includes/osclass/helpers/hPlugins.php(34): Plugins::runHook('init')
#4 /home2/ukagroco/public_html/oc-includes/osclass/core/BaseModel.php(70): osc_run_hook('init')
#5 /home2/ukagroco/public_html/oc-includes/osclass/controller/custom.php(28): BaseModel->__construct()
#6 /home2/ukagroco/public_html/index.php(169): CWebCustom->__construct()
#7 {main}
  thrown in /home2/ukagroco/public_html/oc-content/plugins/google_login/src/auth/Google_OAuth2.php on line 112

The error itself is not always formed, but only for a certain set of events.

The order is as follows: The user enters the site and installs the PWA Osclass Plugin, but continues to stay in his Internet browser, then the user decides to log in to the site, but he is in the browser and not in the application. Having passed the Google Login Osclass Plugin authorization, the user gets to the ERROR500 page. If if the PWA Osclass Plugin is authorized, there is no error. If you log in there is no error in the browser. And if you have an application and you log in to the browser, we get an error.

Sorry for my English, if it's not clear, I'll try to explain somehow.


« Last Edit: July 05, 2022, 08:28:42 PM by Vlad7 »

*

mwindey

  • *****
  • 478 posts
@Vlad7

I started this thread a few weeks ago because I have the same problem with it. I was not able to reproduce since then, so thanks for the clear info about the event...
Hopefully there I a fix...
https://forums.osclasspoint.com/pwa-progressive-web-app-osclass-plugin/if-pwa-installed-on-device-and-user-is-login-in-with-browser-instead-fail/
« Last Edit: July 05, 2022, 11:13:30 PM by mwindey »

*

MB Themes

Ok can you form steps for reproduction? No need to know when it does not happen. Then will need to think about if it is possible to fix and let's say skip PWA.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vlad7

  • ****
  • 244 posts
To begin with, we delete the PWA application on our phone if it is installed, delete the site settings and clean the cookies, we do it as if you first visited the site.
I am using Google Chrome browser. All the actions that I will show are usually used by each user when entering the site for the first time, that is, we simply perform a step-by-step procedure.

1. Find your site and go to it.
2. Install the PWA application
3. We return and perform authorization.
4. We get an error.

This error only occurs in that order. If you do not have a PWA application, authorization in the browser occurs without errors. If you visit the site using the PWA application and log in, there will be no error.

https://drive.google.com/file/d/1Qhojq7t1Nx2isVwdIFcpeSaIMdB17c0k/view?usp=sharing

*

MB Themes

@vlad7
Ok, in pwa/js/pwa-service-worker.js, find:
Code: [Select]
{OC_ADMIN_DIR}
Replace it with:
Code: [Select]
gglLogin
Refresh worker and try login again.
This is just experimental, you should revert changes after testing (maybe you must disable in browser "application > Bypass for network" to be able to work OK in backoffice).

This should simply disable workers when URL contains gglLogin, when working ok, we can go with fixing.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vlad7

  • ****
  • 244 posts
There are 11 {OC_ADMIN_DIR} lines in the pwa-service-worker.js file, should they all be replaced by gglLogin ?

*

MB Themes

Yes,
first you replace all occurences of /{OC_ADMIN_DIR}/ and then also those that are just {OC_ADMIN_DIR}   (all to gglLogin)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vlad7

  • ****
  • 244 posts
Made a replacement, updated the worker. Nothing has changed, still the error.

*

MB Themes

@Vlad7
Ok, then issue will be much more complicated, I will put it into list and try to identify issue.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vlad7

  • ****
  • 244 posts
Re: Google Login Osclass Plugin Compatibility issue with PWA Osclass Plugin
« Reply #9 on: August 29, 2022, 12:03:47 PM »
Managed to solve this problem?

*

bemtele

  • ***
  • 97 posts
Re: Google Login Osclass Plugin Compatibility issue with PWA Osclass Plugin
« Reply #10 on: October 14, 2022, 01:37:15 AM »
Managed to solve this problem?

Have you solved it?

*

MB Themes

Re: Google Login Osclass Plugin Compatibility issue with PWA Osclass Plugin
« Reply #11 on: October 14, 2022, 09:19:51 AM »
Yes,
first you replace all occurences of /{OC_ADMIN_DIR}/ and then also those that are just {OC_ADMIN_DIR}   (all to gglLogin)

If this does not help, that works for backoffice to not be part of service worker, then I am not sure there is solution
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bemtele

  • ***
  • 97 posts
Re: Google Login Osclass Plugin Compatibility issue with PWA Osclass Plugin
« Reply #12 on: October 14, 2022, 11:10:24 AM »
Yes,
first you replace all occurences of /{OC_ADMIN_DIR}/ and then also those that are just {OC_ADMIN_DIR}   (all to gglLogin)

If this does not help, that works for backoffice to not be part of service worker, then I am not sure there is solution

Yes, the same error. But what I have noticed is that when the error comes and you quit the app and open it again. It login and work all right on both the PWA and normal mobile browser.

*

MB Themes

Re: Google Login Osclass Plugin Compatibility issue with PWA Osclass Plugin
« Reply #13 on: October 14, 2022, 01:15:36 PM »
@bemtele
We can do some more testing, if you have issue "ready" to be tested, create support ticket and send FTP login, we will try to do some testing with service worker if it can be bypassed.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots