fix: handle oauth provider id mismatch correctly

This commit is contained in:
Stavros
2026-03-30 23:02:13 +03:00
parent ce581a76f1
commit da247f8552
4 changed files with 18 additions and 5 deletions

View File

@@ -17,9 +17,10 @@ type OAuthService struct {
config *oauth2.Config
ctx context.Context
userinfoExtractor UserinfoExtractor
id string
}
func NewOAuthService(config config.OAuthServiceConfig) *OAuthService {
func NewOAuthService(config config.OAuthServiceConfig, id string) *OAuthService {
httpClient := &http.Client{
Timeout: 30 * time.Second,
Transport: &http.Transport{
@@ -45,6 +46,7 @@ func NewOAuthService(config config.OAuthServiceConfig) *OAuthService {
},
ctx: ctx,
userinfoExtractor: defaultExtractor,
id: id,
}
}
@@ -57,6 +59,10 @@ func (s *OAuthService) Name() string {
return s.serviceCfg.Name
}
func (s *OAuthService) ID() string {
return s.id
}
func (s *OAuthService) NewRandom() string {
// The generate verifier function just creates a random string,
// so we can use it to generate a random state as well