mirror of
https://github.com/int128/kubelogin.git
synced 2026-08-23 21:06:15 +00:00
Merge pull request #15 from int128/refresh-token
Fix refresh token is not set with Google IdP
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user