diff --git a/api/routes.go b/api/routes.go index 0469813..cc23744 100644 --- a/api/routes.go +++ b/api/routes.go @@ -39,10 +39,17 @@ type ClientParams struct { func getClient(params ClientParams) (*gitea.Client, error) { options := make([]gitea.ClientOption, 0) + authToken := "" if len(params.AuthToken) > 0 { - options = append(options, gitea.SetToken(params.AuthToken)) + authToken = params.AuthToken } + if len(authToken) == 0 { + authToken = params.Config.Oauth.Token + } + + options = append(options, gitea.SetToken(authToken)) + client, err := gitea.NewClient(params.Config.GiteaUrl, options...) if err != nil { return nil, err