How to use OAuth?

Hi!

I tried to activate the OAuth Module in Dolibarr 3.9.2 but I could not find any further information to make it working.

Of course I created the OAuth-2.0-Client-ID (Google APi ID and Secret) and then set MAIN_AUTHENTICATION_OPENID_URL to “https://accounts.google.com/o/oauth2/v2/auth”. Is that correct?

Anyway I can not login. Any ideas?

Thank you!
Sebastian

1 Like

As well I changed the conf/conf.php:
$dolibarr_main_authentication=‘openid’;

What is the URL to use in this redirect: MAIN_AUTHENTICATION_OPENID_URL

Hello, I already created the URL for MAIN_AUTHENTICATION_OPENID_URL.

Now I need to know if there is to reconfigure some line of the google_oauthcallback.php and the functions_googleoauth.php?

Hello @sbschumacher for the URL, I recommend you check this video: https://youtu.be/hazMyK_cnzk

There, a URL is generated that can be used to access the Google login.

You need to configure some lines in the google_oauthcallback.php and functions_googleoauth.php files. These files handle the authentication flow and processing of OAuth requests.
In the google_oauthcallback.php file, you might need to adjust the configuration to match your specific setup. Look for lines that define variables like $googleClientId and $googleClientSecret .
In the functions_googleoauth.php file, you might need to modify the code that handles the OAuth authentication process. Look for functions related to Google OAuth, such as googleauth_getauthorizationurl() and googleauth_getuserinfo() . These functions interact with the Google API and retrieve user information.