# Permission to add GoogleDrive to WorkplaceSearch

**URL:** <https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288>\
**Category:** Elastic Search\
**Tags:** elastic-workplace-search\
**Created:** [May 28, 2021, 6:12am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288 "2021-05-28T06:12:49Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 8, 2021, 2:38pm UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/21 "2021-06-08T14:38:06Z")

</div>

@maryna.cherniavska  
Thank you for your comments.

All, yes.  
As for 5., technically, it specifies `ENT_SEARCH_DEFAULT_PASSWORD`. (To make the password clear)

```auto
$ ENT_SEARCH_DEFAULT_PASSWORD=[REDACTED] bin/enterprise-search

```

---

<div class="post-metadata">

**Author:** ![maryna.cherniavska](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maryna.cherniavska/32/89935_2.png) [@maryna.cherniavska](https://discuss.elastic.co/u/maryna.cherniavska)\
**Post date:** [June 8, 2021, 2:52pm UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/22 "2021-06-08T14:52:43Z")

</div>

But previously you provided this:

> [@its-ogawa](#):
>
> `ent_search.external_url: http://XXX.XXX.XXX.XXX:3002`

Which looks like it's an IP address and not a hostname?

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 8, 2021, 3:08pm UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/23 "2021-06-08T15:08:01Z")

</div>

Oh. I'm sorry. I made a mistake.

As mentioned above, I had specified the IP address and port.  
I changed this to the server name and rebooted.

```auto
#ent_search.external_url: http://XXX.XXX.XXX.XXX:3002 # <- remove
ent_search.external_url: http://MY_SERVER # <- add

```

However, there are two problems in this case.

One is that my NGINX redirects the given URL to the following, which causes the page to be NotFound.  
https://MY\_SERVER/workplacesearch/ -\> https://MY\_SERVER/login  
I am expecting it to go to https://MY\_SERVER/workplacesearch/login.

Second, though, the page accessed by specifying https://MY\_SERVER/workplacesearch/login shows EnterpriseSearch.  
However, the login process cannot be executed because the root directory is configured incorrectly.

---

<div class="post-metadata">

**Author:** ![Sean\_Story](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sean_story/32/69987_2.png) [@Sean\_Story](https://discuss.elastic.co/u/Sean_Story)\
**Post date:** [June 8, 2021, 3:46pm UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/24 "2021-06-08T15:46:51Z")

</div>

I think we're getting close.

If you still have:

> [@its-ogawa](#):
>
> ```auto
> location /workplacesearch/ {
> proxy_pass http://127.0.0.1:3002/;
> }
> 
> ```

Then I believe you need:

```bash
ent_search.external_url: http://MY_SERVER/workplacesearch

```

`ent_search.external_url` needs to be set to the URL that is public-facing. This same URL needs to be the prefix to your redirect-URI for google, as well.

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 8, 2021, 4:23pm UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/25 "2021-06-08T16:23:14Z")

</div>

Thank you for your comment.

```auto
ent_search.external_url: http://MY_SERVER/workplacesearch

```

I have tried this before and get the following error. (This was posted on June 6)

```auto
$ ENT_SEARCH_DEFAULT_PASSWORD=passwordexample bin/enterprise-search
Found java executable in PATH
Java version detected: 1.8.0_282 (major version: 8)
Enterprise Search is starting...

--------------------------------------------------------------------------------

Invalid config file (/usr/share/enterprise-search/config/enterprise-search.yml):
The setting '#/ent_search/external_url' cannot have a path: 'https://MY_SERVER/workplacesearch'

--------------------------------------------------------------------------------

```

ross.bell pointed this out to me.

> That setting can't contain a url path. It needs to be just https://MY\_SERVER. It can also include a port.

---

<div class="post-metadata">

**Author:** ![maryna.cherniavska](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maryna.cherniavska/32/89935_2.png) [@maryna.cherniavska](https://discuss.elastic.co/u/maryna.cherniavska)\
**Post date:** [June 9, 2021, 8:27am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/26 "2021-06-09T08:27:32Z")

</div>

As Ross said above:

> [@Permission to add GoogleDrive to WorkplaceSearch](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/13):
>
> That setting can't contain a url path. It needs to be just https://MY\_SERVER. It can also include a port.

So, currently I see this.

1. The `external_url` setting is supposed to contain no path parameters (but it can contain the port).
2. nginx makes a redirect that goes to `https://MY_SERVER:3002/workplacesearch` which opens the login page, but the login page then doesn't work as the root path isn't supposed to contain `workplacesearch `

@its-ogawa I am no nginx expert, but could you try also this nginx config?

```auto
location = / {
        proxy_pass http://127.0.0.1:3002/;
}

```

and see what happens?

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 9, 2021, 9:46am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/27 "2021-06-09T09:46:01Z")

</div>

> [@maryna.cherniavska](#):
>
> @its-ogawa I am no nginx expert, but could you try also this nginx config?
> 
> ```auto
> location = / {
> proxy_pass http://127.0.0.1:3002/;
> }
> 
> ```
> 
> and see what happens?

Thanks for the advice.

Indeed, with this combination you mentioned, the redirects match and I can access WorkplaceSearch by typing https://MY\_SERVER into my browser.

```auto
$ vi /usr/share/enterprise-search/config/enterprise-search.yml
... snip ...
# ------------------------------- Elasticsearch -------------------------------
elasticsearch.host: https://MY_SERVER
... snip ...

```

```auto
# cat /etc/nginx/conf.d/ssl.conf
server {
... snip ...
    location / {
        proxy_pass http://127.0.0.1:3002/;
    }
... snip ...
}

```

Why can't the `external_url` include the path?  
That seems to be a bit of a strict rule.

---

<div class="post-metadata">

**Author:** ![maryna.cherniavska](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maryna.cherniavska/32/89935_2.png) [@maryna.cherniavska](https://discuss.elastic.co/u/maryna.cherniavska)\
**Post date:** [June 9, 2021, 6:38pm UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/28 "2021-06-09T18:38:18Z")

</div>

> [@its-ogawa](#):
>
> Why can't the `external_url` include the path?  
> That seems to be a bit of a strict rule.

I can't say for sure as I am pretty new on the team. But is the Google Drive connector now working for you? Is the problem resolved?

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 10, 2021, 1:15am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/29 "2021-06-10T01:15:42Z")

</div>

Thank you for contacting us.  
With this setting, the first error I told you about when connecting no longer occurs.

> [@its-ogawa](#):
>
> Using this credentials, in WorkplaceSearch, I added the GoogleDrive content source, but when I press the "Connect to Google Drive" button, I get the following error.
> 
> ```auto
> Authorization Error
> Error 400: invalid_request
> Invalid parameter value for redirect_uri: Raw IP addresses not allowed: http://MY_SERVER:3002/ws/org/sources/google_drive/create
> 
> ```

Thank you very much.

However, when I look at the `Source overview` in WorkplaceSearch, it shows "No content yet".  
Is there any other setting I need to do?

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 10, 2021, 2:01am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/30 "2021-06-10T02:01:47Z")

</div>

> [@its-ogawa](#):
>
> However, when I look at the `Source overview` in WorkplaceSearch, it shows "No content yet".  
> Is there any other setting I need to do?

I'm sorry. I found the cause.

If I hover the cursor over Error in `STATUS` of `Recent activity`, I will see the following message.

```auto
Error after less than 20 seconds
Updated 0 items Failure caused by: Google::Apis::ClientError:accessNotConfigured: Access Not Configured. Drive API has not been used in project 662020117380 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=662020117380 then retry. If youenabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

```

I had to go to the given URL and select "Enable API" from the GoogleCloudPlatform screen.

The `STATUS` is now `Working` and the number of documents it recognizes is increased.

---

<div class="post-metadata">

**Author:** ![maryna.cherniavska](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maryna.cherniavska/32/89935_2.png) [@maryna.cherniavska](https://discuss.elastic.co/u/maryna.cherniavska)\
**Post date:** [June 10, 2021, 8:25am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/31 "2021-06-10T08:25:44Z")

</div>

@its-ogawa well done! Please come back if you have more questions.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 31, 2022, 2:48am UTC](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288/32 "2022-10-31T02:48:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.

[Previous page](https://discuss.elastic.co/t/permission-to-add-googledrive-to-workplacesearch/274288.md?page=1)
