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

Add Google Sheets exporter with login #118

Merged
merged 23 commits into from
Nov 14, 2020
Merged

Add Google Sheets exporter with login #118

merged 23 commits into from
Nov 14, 2020

Conversation

baruchiro
Copy link
Collaborator

@baruchiro baruchiro commented Nov 5, 2020

close #84

Comment on lines +3 to +5
// https://console.developers.google.com/apis/credentials
GOOGLE_CLIENT_ID: JSON.stringify(process.env.GOOGLE_CLIENT_ID),
GOOGLE_CLIENT_SECRET: JSON.stringify(process.env.GOOGLE_CLIENT_SECRET),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brafdlog Need to register these values in Google, put them as Repository Secrets, and write them to Env Vars in our Github Actions.

Of course, I created them myself, maybe I can give you access to my registered app in Google, or maybe you register it again yourself.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still embed the secret in the built code. Which oauth flow did you use? The installed applications flow looks like that one we should use and in that flow the client secret is not considered a secret (See https://developers.google.com/identity/protocols/oauth2#installed)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They changed the documentation a little, and it more detailed now. Anyway, I think I choose the right one:

image

image

@baruchiro baruchiro requested a review from brafdlog November 9, 2020 19:56
@baruchiro baruchiro marked this pull request as ready for review November 9, 2020 19:56
@baruchiro
Copy link
Collaborator Author

I opened #120 to continue to work in the backend.

I will comment on this PR later, but you can start to look.

Comment on lines 27 to 34
<div v-else>
<v-btn
color="primary"
@click="login()"
>
Login to Google
</v-btn>
</div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user is not logged in, this button will display.

Both this button and the dropdown are under the vForm since the two are changing the config. The login button produces the credentials and saves them in the config, then the dropdown uses the credentials to get a list of spreadsheets from the user account.

Later, with Vue 3 we can use Suspance

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I changed it to be statefull by enum, the commit is on the queue.

@@ -52,8 +48,7 @@ export interface JsonConfig extends OutputVendorConfigBase {

export interface GoogleSheetsConfig extends OutputVendorConfigBase {
options: {
credentialsFilePath: string;
sheetName: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it for now and use a const value

Comment on lines +3 to +5
// https://console.developers.google.com/apis/credentials
GOOGLE_CLIENT_ID: JSON.stringify(process.env.GOOGLE_CLIENT_ID),
GOOGLE_CLIENT_SECRET: JSON.stringify(process.env.GOOGLE_CLIENT_SECRET),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still embed the secret in the built code. Which oauth flow did you use? The installed applications flow looks like that one we should use and in that flow the client secret is not considered a secret (See https://developers.google.com/identity/protocols/oauth2#installed)

…s/googleSheets.ts


Oh no, I'm still falling for it ...
In my company, I wrote all `budge` for embedded `badge`...

Co-authored-by: Jonathan <brafdlog@gmail.com>
@baruchiro baruchiro merged commit bdd73ce into unifyRepos Nov 14, 2020
@baruchiro baruchiro deleted the SheetsExporter branch November 14, 2020 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the google sheets exporter in the library code work with the oauth flow
2 participants