Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google drive options client_id and client_secret in roots don't work #3524

Closed
Nounours13 opened this issue Sep 21, 2022 · 2 comments
Closed
Labels

Comments

@Nounours13
Copy link
Contributor

Hi,
On line 108 to 121 on elFinderVolumeGoogleDrive.class.php there is all options for Gdrive connection:

       $opts = [
                  'client_id' => '',
                  'client_secret' => '',
                  'access_token' => [],
                  'refresh_token' => '',
                  'serviceAccountConfigFile' => '',
                  'root' => 'My Drive',
                  'gdAlias' => '%s@GDrive',
                  'googleApiClient' => '',
                  'path' => '/',
                  'tmbPath' => '',
                  'separator' => '/',
                  'useGoogleTmb' => true,
                  'acceptedName' => '#.#',
                   ....__

If I use :

        roots = array(
                             array(
                                        'driver'                => 'GoogleDrive',
                                        'refresh_token'   => '1//xxxxxx',
                                         'client_id'           => '513xxxxxxxxxxxxxxxxx',
                                         'client_secret'     => 'GOxxxxxxxxxxxxxxxxxx',
                                    'path'		      => '/',
                                        'root'                    => 'My GDrive'
                                      );  
                              );_  

all options are taken except client_id and client_secret

I must add :

    define('ELFINDER_GOOGLEDRIVE_CLIENTID','513xxxxxxxx');
    define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', 'GOCxxxxxxx');

otherwise i've an error : "Driver "elFinderVolumeGoogleDrive" : Required option "client_id" is undefined."

I don't understand why it doesn't work with the roots declaration because, in line 620 on elFinderVolumeGoogleDrive.class.php there are:

    public function netmountPrepare($options)
        {
            if (empty($options['client_id']) && defined('ELFINDER_GOOGLEDRIVE_CLIENTID')) {
                $options['client_id'] = ELFINDER_GOOGLEDRIVE_CLIENTID;
            }
            if (empty($options['client_secret']) && defined('ELFINDER_GOOGLEDRIVE_CLIENTSECRET')) {
                $options['client_secret'] = ELFINDER_GOOGLEDRIVE_CLIENTSECRET;
            }
            if (empty($options['googleApiClient']) && defined('ELFINDER_GOOGLEDRIVE_GOOGLEAPICLIENT')) {
                $options['googleApiClient'] = ELFINDER_GOOGLEDRIVE_GOOGLEAPICLIENT;
                include_once $options['googleApiClient'];
            }

I don't know if it's me who made a mistake or if it's a bug. thank you for your reply.

Otherwise, using the define, it works fine.

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

This issue is stale because it has been open for 50 days with no activity.

@github-actions github-actions bot added the stale label Jun 6, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant