-
Notifications
You must be signed in to change notification settings - Fork 118
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
flank auth login #449
flank auth login #449
Conversation
5394c79
to
64deb6f
Compare
Codecov Report
@@ Coverage Diff @@
## master #449 +/- ##
============================================
- Coverage 79.32% 78.55% -0.77%
- Complexity 630 640 +10
============================================
Files 69 73 +4
Lines 1790 1833 +43
Branches 271 272 +1
============================================
+ Hits 1420 1440 +20
- Misses 195 217 +22
- Partials 175 176 +1 |
807520a
to
c587bb4
Compare
@@ -36,6 +39,10 @@ class Main : Runnable { | |||
private var printVersion = false | |||
|
|||
companion object { | |||
init { | |||
// GoogleApiLogger.logAllToStdout() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this left here for debugging purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it'll be cleaned up as part of #446
import java.io.IOException | ||
|
||
// https://github.com/googleapis/google-oauth-java-client | ||
// Code from: https://developers.google.com/sheets/api/quickstart/java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd help to add some context to the comment (like why you chose to copy from sheets)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comment. The usage of GoogleAuthorizationCodeFlow
is the same for any Google service. When the API changes, Google updates their official reference documentation.
HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport() | ||
DATA_STORE_FACTORY = FileDataStoreFactory(CRED_FOLDER) | ||
} catch (t: Throwable) { | ||
t.printStackTrace() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is copied code or not, but why not let the exception propagate or just rethrow it as a RuntimeException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Updated.
} | ||
} | ||
|
||
fun activateUserAuth(): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing kdoc. Also, it seems strange that this would return a boolean (based on the naming of the method).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to hasUserAuth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kdoc isn't used at the moment on the methods. A PR will be adding detekt support soon. At that point we may decide to enforce function docs.
val CRED = File(CRED_FOLDER, "StoredCredential") | ||
|
||
// https://github.com/bootstraponline/gcloud_cli/blob/40521a6e297830b9f652a9ab4d8002e309b4353a/google-cloud-sdk/platform/gsutil/gslib/utils/system_util.py#L177 | ||
private val clientId = "32555940559.apps.googleusercontent.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it by design that these are hardcoded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, they're hardcoded in gcloud CLI as well.
00fb8c0
to
b5e18c1
Compare
b5e18c1
to
099efb5
Compare
Fix #398
Flank now allows you to login as a user. Type
flank auth login
and follow the web prompt. User auth is an alternative to using a service account.