diff --git a/services/auth/source/oauth2/init.go b/services/auth/source/oauth2/init.go index 5c25681548..fba0f58fad 100644 --- a/services/auth/source/oauth2/init.go +++ b/services/auth/source/oauth2/init.go @@ -30,10 +30,14 @@ const ProviderHeaderKey = "gitea-oauth2-provider" // Init initializes the oauth source func Init(ctx context.Context) error { - if err := InitSigningKey(); err != nil { - return err + // this is for oauth2 provider + if setting.OAuth2.Enabled { + if err := InitSigningKey(); err != nil { + return err + } } + // others for oauth2 clients // Lock our mutex gothRWMutex.Lock()