-
Notifications
You must be signed in to change notification settings - Fork 85
Add oauth2l-go #21
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 oauth2l-go #21
Conversation
| return token | ||
| } | ||
|
|
||
| // Get an OAuth2 token given a client secret json or service account json. |
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.
Get an OAuth 2 access token for the specified OAuth client info and scopes.
clientInfo: a JSON text that represents either an OAuth client ID or a service account.
scopes: a list of OAuth scopes. If the scope is not a normal URL, it will be prefixed with xxx.
return: the return value will be xxx.
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.
Done
|
Great job. Initial set of comments. After we are done, let's ask Olson to comment on Go style. |
|
Have you submitted the new changes? |
|
Not yet, fixing some style issue |
|
Uploaded new chage |
| func defaultAuthorizeFlowHandler(authorizeUrl string) string { | ||
| // Print the url on console, let user authorize and paste the token back. | ||
| fmt.Printf("Go to the following link in your browser:\n\n %s\n\n", | ||
| authorizeUrl) |
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 remember Go doesn't have line length limit. Why do we need to wrap the code?
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.
Removed line break
go/src/oauth2client/oauth2client.go
Outdated
| } | ||
|
|
||
| // Run the three-legged oauth authorize flow. | ||
| func authorizeFlow(secret map[string]interface{}, scopes string, handler func(string) string) string { |
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.
Use "scope string" everywhere in this file, because that is OAuth 2 spec. The scopes []string should only be used in the main.go.
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.
Done
|
I think we are almost there. |
b7e0788 to
cd9a979
Compare
go/src/oauth2client/oauth2client.go
Outdated
| fmt.Printf("Go to the following link in your browser:\n\n %s\n\n", authorizeUrl) | ||
|
|
||
| fmt.Println("Enter verification code: ") | ||
| code := "" |
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.
var code string
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.
Done
|
LGTM Please return original error as much as possible. |
|
LGTM Well done. |
Tests pending
To try it:
export GOPATH=[path/to]/oauth2l/oauth2l-go
go run [path/to]/oauth2l-go/src/oauth2l/oauth2l.go --json <secret.json> fetch cloud-platform