Dolibarr: 3.9.0-beta Printing error

Big brother is watching me:

Fred

I don’t know exactly what i’m doing wrong…
I’ve followed the stepts exactly in your posts.

This is the message for now: (Sorry most written in Dutch)

Installed:
- Dolibarr 3.9rc
- Oauth
- Directprinting

Printer shows up at Google Cloudprinting and is already configured.
Brother printer supports Cloudprinting.

Hello
Seem missing table:

CREATE TABLE IF NOT EXISTS llx_oauth_state (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), state varchar(128), fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS llx_oauth_token (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), token text, fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Fred

Still the message:

Hello
Try to create doli_auth_token table in place of llx_oauth_token

Fred

Changed the last code… no error for now.
But the next setting don’t work…

1.png

To request en new token, the link ends at my own (error 404)webpage outside Dolibarr. So no token to request.
Click here to request/renew access and receive a new token to save

From GitHub the file getgoogleoauthcallback.php uploaded, the link works…

And again:

Hello
Can you create the table doli_oauth_state:
CREATE TABLE IF NOT EXISTS doli_oauth_state (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), state varchar(128), fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Fred

Hello
The file getgoogleoauthcallback.php has been renamed in google_oauthcallback.php and it is why it’s no longer working
you can use getgoogleoauthcallback.php and set this address in google api

Fred

1 Like

I looked at the code:

~\core\modules\oauth\google_oauthcallback.php (48): $currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php');

and changed getgoogleoauthcallback.php to google_oauthcallback.php

Finaly it works :happy: Thanks for your patience, help and time !!

Salut Fred,

Je suis coincé avec le probleme d’autorisé le token pour aficher les imprimantes. J’ai deja lu un thread ou tu as donner la solution mais je nai pas bien compris stp je voulais demander si tu peut expliquer d’avantage. Je suis anglophone mon francais n’est pas tres bon.

Hello
Your server is linux or win?
Some people have problems with curl and windows because ssl certificates are not up to date.
Fred

Hello Fred,

Am using windows. Please help me

@Fred,

I am using windows i have copied the code from github and now i don’t have errors but now no token after giving authorisation.

@Frederick,

I am using windows i have copied the code from github and now i don’t have errors but now no token after giving authorisation.

Hello
Try to edit google_oauthcallback.php about line 130 à 140

    $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
    unset($_SESSION["backtourlsavedbeforeoauthjump"]);
    print '<pre>'.print_r($apiService, true).'</pre>';
    print '<pre>'.print_r($token, true).'</pre>';
    //header('Location: ' . $backtourl);
    exit();
}
else // If entry on page with no parameter, we arrive here
{
    $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;

Do you have curl error?
Do not post full result, it may contain private data.

Fred

@frederic34,

I get this error. And the line i had to replace was not 130 this time around. Since i have copied the code from github the line to replace was line 105.

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in C:\dolibarr\www\dolibarr\htdocs\includes\OAuth\Common\Http\Client\CurlClient.php on line 107
cURL Error # 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:confused:SL routines:confused:SL3_GET_SERVER_CERTIFICATE:certificate verify failed

OAuth\OAuth2\Service\Google Object

Hello
Same problem with curl and ssl certificate not updated in windows wamp:

Download the file cacert.pem here:
http://curl.haxx.se/ca/cacert.pem (file is often updated)
put it in the directory where php is installed
modify le php.ini and add (or update)
curl.cainfo=c:\php\cacert.pem (take care of the directory name)

maybe you can have two php.ini
and restart server

Fred

@frederick24,

this is actually where am having a problem. Where is the php installed please can you refer and where can i see the php.ini file. Since you have more experience with this please refer me to save time.

Hello
There are several pages on how to do that like:
https://docs.bolt.cm/release-2-2/howto/curl-ca-certificates

Fred