diff --git a/auth/provider/oauth/oauth.go b/auth/provider/oauth/oauth.go index 45b79c8e..d04d7cf7 100644 --- a/auth/provider/oauth/oauth.go +++ b/auth/provider/oauth/oauth.go @@ -41,6 +41,10 @@ func (o *oauth) Endpoint(opts ...provider.EndpointOption) string { params.Add("state", options.State) } + if len(options.LoginHint) > 0 { + params.Add("login_hint", options.LoginHint) + } + if clientID := o.opts.ClientID; len(clientID) > 0 { params.Add("client_id", clientID) } diff --git a/auth/provider/provider.go b/auth/provider/provider.go index 26f80034..09e78bdf 100644 --- a/auth/provider/provider.go +++ b/auth/provider/provider.go @@ -28,7 +28,10 @@ type Grant struct { } type EndpointOptions struct { + // State is a code to verify the req State string + // LoginHint prefils the user id on oauth clients + LoginHint string } type EndpointOption func(*EndpointOptions) @@ -38,3 +41,9 @@ func WithState(c string) EndpointOption { o.State = c } } + +func WithLoginHint(hint string) EndpointOption { + return func(o *EndpointOptions) { + o.LoginHint = hint + } +}