Skip to content

Commit 0b1b143

Browse files
committed
Fix oauth2 sync error
We'd better to use id to find a user. Not LoginName. And LoginName!= ExternalID
1 parent 23a37b4 commit 0b1b143

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/auth/source/oauth2/source_sync.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
4747
}
4848

4949
func (source *Source) refresh(ctx context.Context, provider goth.Provider, u *user_model.ExternalLoginUser) error {
50-
log.Trace("Syncing login_source_id=%d external_id=%s expiration=%s", u.LoginSourceID, u.ExternalID, u.ExpiresAt)
50+
log.Trace("Syncing login_source_id=%d external_id=%s user_id=%s expiration=%s", u.LoginSourceID, u.ExternalID, u.UserID, u.ExpiresAt)
5151

5252
shouldDisable := false
5353

@@ -62,7 +62,7 @@ func (source *Source) refresh(ctx context.Context, provider goth.Provider, u *us
6262
}
6363

6464
user := &user_model.User{
65-
LoginName: u.ExternalID,
65+
ID: u.UserID,
6666
LoginType: auth.OAuth2,
6767
LoginSource: u.LoginSourceID,
6868
}

0 commit comments

Comments
 (0)