From a92e57c8ded878f3695c3a92edc84936022befbd Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Fri, 5 Apr 2024 07:22:05 +0200 Subject: [PATCH] Since go 1.22 path variables are supported --- gothic/gothic.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gothic/gothic.go b/gothic/gothic.go index 86adf58e..bc8cb0f6 100644 --- a/gothic/gothic.go +++ b/gothic/gothic.go @@ -287,6 +287,12 @@ func getProviderName(req *http.Request) (string, error) { return p, nil } + // since go-1.22 this is also supported + // see: https://go.dev/blog/routing-enhancements + if p := req.PathValue("provider"); p != "" { + return p, nil + } + // As a fallback, loop over the used providers, if we already have a valid session for any provider (ie. user has already begun authentication with a provider), then return that provider name providers := goth.GetProviders() session, _ := Store.Get(req, SessionName)