diff --git a/cmd/example-app/main.go b/cmd/example-app/main.go index 21b025d2..ccf9c4ca 100644 --- a/cmd/example-app/main.go +++ b/cmd/example-app/main.go @@ -237,6 +237,10 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) { for _, client := range clients { scopes = append(scopes, "audience:server:client_id:"+client) } + connectorID := "" + if id := r.FormValue("connector_id"); id != "" { + connectorID = id + } authCodeURL := "" scopes = append(scopes, "openid", "profile", "email") @@ -248,6 +252,9 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) { } else { authCodeURL = a.oauth2Config(scopes).AuthCodeURL(exampleAppState, oauth2.AccessTypeOffline) } + if connectorID != "" { + authCodeURL = authCodeURL + "&connector_id=" + connectorID + } http.Redirect(w, r, authCodeURL, http.StatusSeeOther) } diff --git a/cmd/example-app/templates.go b/cmd/example-app/templates.go index 3a4b5bb2..09b4150a 100644 --- a/cmd/example-app/templates.go +++ b/cmd/example-app/templates.go @@ -15,8 +15,11 @@ var indexTmpl = template.Must(template.New("index.html").Parse(`

Extra scopes:

-

- Request offline access: +

+ Connector ID: +

+

+ Request offline access: