@@ -54,6 +54,9 @@ type Config struct {
5454
5555 // Configurable key which contains the user name claim
5656 UserNameKey string `json:"userNameKey"`
57+
58+ // PromptType will be used fot the prompt parameter (when offline_access, by default prompt=consent)
59+ PromptType string `json:"promptType"`
5760}
5861
5962// Domains that don't support basic auth. golang.org/x/oauth2 has an internal
@@ -113,6 +116,11 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
113116 scopes = append (scopes , "profile" , "email" )
114117 }
115118
119+ // PromptType should be "consent" by default, if not set
120+ if c .PromptType == "" {
121+ c .PromptType = "consent"
122+ }
123+
116124 clientID := c .ClientID
117125 return & oidcConnector {
118126 provider : provider ,
@@ -135,6 +143,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
135143 getUserInfo : c .GetUserInfo ,
136144 userIDKey : c .UserIDKey ,
137145 userNameKey : c .UserNameKey ,
146+ promptType : c .PromptType ,
138147 }, nil
139148}
140149
@@ -156,6 +165,7 @@ type oidcConnector struct {
156165 getUserInfo bool
157166 userIDKey string
158167 userNameKey string
168+ promptType string
159169}
160170
161171func (c * oidcConnector ) Close () error {
@@ -178,7 +188,7 @@ func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string)
178188 }
179189
180190 if s .OfflineAccess {
181- opts = append (opts , oauth2 .AccessTypeOffline , oauth2 .SetAuthURLParam ("prompt" , "consent" ))
191+ opts = append (opts , oauth2 .AccessTypeOffline , oauth2 .SetAuthURLParam ("prompt" , c . promptType ))
182192 }
183193 return c .oauth2Config .AuthCodeURL (state , opts ... ), nil
184194}
0 commit comments