Merge pull request #15 from int128/refresh-token

Fix refresh token is not set with Google IdP
This commit is contained in:
Hidetake Iwata
2018-09-04 06:41:58 +09:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -13,6 +13,7 @@ import (
type authCodeFlow struct {
Config *oauth2.Config
AuthCodeOptions []oauth2.AuthCodeOption
ServerPort int // HTTP server port
SkipOpenBrowser bool // skip opening browser if true
}
@@ -41,7 +42,7 @@ func (f *authCodeFlow) getAuthCode(ctx context.Context) (string, error) {
server := http.Server{
Addr: fmt.Sprintf("localhost:%d", f.ServerPort),
Handler: &authCodeHandler{
authCodeURL: f.Config.AuthCodeURL(state),
authCodeURL: f.Config.AuthCodeURL(state, f.AuthCodeOptions...),
gotCode: func(code string, gotState string) {
if gotState == state {
codeCh <- code
+1
View File
@@ -47,6 +47,7 @@ func (c *Config) GetTokenSet(ctx context.Context) (*TokenSet, error) {
ServerPort: c.ServerPort,
SkipOpenBrowser: c.SkipOpenBrowser,
Config: oauth2Config,
AuthCodeOptions: []oauth2.AuthCodeOption{oauth2.AccessTypeOffline},
}
token, err := flow.getToken(ctx)
if err != nil {