|
|
@@ -107,15 +107,13 @@ func (db *accessTokens) Create(ctx context.Context, userID int64, name string) (
|
|
|
accessToken := &AccessToken{
|
|
|
UserID: userID,
|
|
|
Name: name,
|
|
|
- Sha1: sha256[:40], // To pass the column unique constraint, keep the length of SHA1.
|
|
|
+ Sha1: token,
|
|
|
SHA256: sha256,
|
|
|
}
|
|
|
if err = db.WithContext(ctx).Create(accessToken).Error; err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
- // Set back the raw access token value, for the sake of the caller.
|
|
|
- accessToken.Sha1 = token
|
|
|
return accessToken, nil
|
|
|
}
|
|
|
|