homebrewery icon indicating copy to clipboard operation
homebrewery copied to clipboard

[LOCAL]: How to link local to gdrive ?

Open lucastucious opened this issue 2 years ago • 5 comments

Renderer

v3

Browser

Chrome

Operating System

Windows

What happened?

I tried to install a local homebrewery to test purpose, running on docker. But i can't find a way to login wit Gdrive

Code

No response

lucastucious avatar Jan 03 '23 11:01 lucastucious

Hello! 👋

It's a highly involved process but I'm the person who's done it last, so I'll take some time tonight to do a writeup for you and post it here.

jeddai avatar Jan 20 '23 22:01 jeddai

Oooookay. So here's what I did.

Head to the google cloud console and make a project. You can also use any project you already have available.

Go to "APIs & Services" > "Enabled APIs & Services"

image

If you do not see "Google Drive API" in this list, you'll need to enable it.

image

To enable it, navigate to the "Library" page under "APIs & Services", search for "drive" and select and enable the "Google Drive API"

image

Next, navigate to the "Credentials" page under "APIs & Services". This page will list your API keys, OAuth 2.0 Client IDs, and Service Accounts, and we'll need one of each. To get started, click "Create Credentials" and select "API key". This should create an API key.

image

Next, create an "OAuth client id" credential. It won't actually do it, instead it will prompt you to configure your consent screen. Click "Configure Consent Screen", and it will then ask you if this is an internal or external app. "External" should be selected, then click "Create".

Set an app name, support email, and developer contact email, and click "Save and Continue".

Then you need to add the following Google Drive API scope in the "Manually add scopes" input:

https://www.googleapis.com/auth/drive

Click "Update" to save the scope, then click "Save and Continue". Leave test users empty and click "Save and Continue".

Back on the "Credentials" screen, try to create an OAuth client ID again. Set the application type to "Web Application", give it a name, and click Create.

image

Lastly, create a service account. You should only need to fill in the name, it will pre-fill in the account id. Then click Done, and it will download your service account JSON to your computer.

image

Now, in your local copy of the Homebrewery repo, we need to make some changes to your local config. Add a key for each of google_api_key, google_client_id, and google_client_secret, setting the values for them to the API key, OAuth client ID, and OAuth client secret, respectively. Lastly, copy your service account JSON file to a service_account key.

That should be it!

In order to use Google with a local copy of the Naturalcrit OAuth setup, there's a much longer process that frankly even I have not attempted to do. Instead, I navigate to the deployed Naturalcrit login page, and re-authenticate with google. Then I take the JWT to jwt.io and use their editor to switch the secret to the secret in my local config. Then the resulting JWT is placed in my localhost's storage and that works for ~1 day before I need to re-auth.

Feel free to reach out with any questions you might have.

jeddai avatar Jan 21 '23 05:01 jeddai

@lucastucious did Jeddai's answer help you? did it not? could you give some feedback?

5e-Cleric avatar Feb 04 '23 15:02 5e-Cleric

we need to make some changes to your local config

To clarify, this is the file config/local.json.

Mine looks a little like this: image

G-Ambatte avatar Feb 29 '24 23:02 G-Ambatte

We need to add this to the local install documents. As a separate document, referenced from the others.

dbolack-ab avatar Jun 05 '24 22:06 dbolack-ab