@@ -57,6 +57,7 @@ func (u *GitIdentityUsecase) List(ctx context.Context, uid uuid.UUID) ([]*domain
5757 repos , err := client .Repositories (ctx , & domain.RepositoryOptions {
5858 Token : token ,
5959 InstallID : identity .InstallationID ,
60+ IsOAuth : identity .OauthRefreshToken != "" ,
6061 })
6162 if err != nil {
6263 u .logger .WarnContext (ctx , "failed to get authorized repositories" , "error" , err , "platform" , identity .Platform , "identity_id" , identity .ID )
@@ -73,7 +74,7 @@ func (u *GitIdentityUsecase) gitClienter(identity *db.GitIdentity) domain.GitCli
7374 case consts .GitPlatformGithub :
7475 return github .NewGithub (u .logger , u .cfg )
7576 case consts .GitPlatformGitLab :
76- return gitlab .NewGitlab (identity .BaseURL , identity . AccessToken , u .logger )
77+ return gitlab .NewGitlabForBaseURL (identity .BaseURL , u .logger )
7778 case consts .GitPlatformGitea :
7879 return gitea .NewGitea (u .logger , identity .BaseURL )
7980 case consts .GitPlatformGitee :
@@ -104,6 +105,7 @@ func (u *GitIdentityUsecase) Get(ctx context.Context, uid uuid.UUID, id uuid.UUI
104105 repos , err := client .Repositories (ctx , & domain.RepositoryOptions {
105106 Token : token ,
106107 InstallID : identity .InstallationID ,
108+ IsOAuth : identity .OauthRefreshToken != "" ,
107109 })
108110 if err != nil {
109111 u .logger .WarnContext (ctx , "failed to get authorized repositories" , "error" , err , "platform" , identity .Platform , "identity_id" , id )
@@ -209,8 +211,13 @@ func (u *GitIdentityUsecase) ListBranches(ctx context.Context, uid uuid.UUID, id
209211 return nil , errcode .ErrInvalidPlatform
210212 }
211213
214+ token , err := u .tokenProvider .GetToken (ctx , identity .ID )
215+ if err != nil {
216+ return nil , fmt .Errorf ("get token: %w" , err )
217+ }
218+
212219 branches , err := client .Branches (ctx , & domain.BranchesOptions {
213- Token : identity . AccessToken , Owner : owner , Repo : repo ,
220+ Token : token , Owner : owner , Repo : repo ,
214221 Page : page , PerPage : perPage ,
215222 InstallID : identity .InstallationID , IsOAuth : identity .OauthRefreshToken != "" ,
216223 })
0 commit comments