Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

box: fix reconnect failing with HTTP 400 Bad Request

albertony0d34efb10f7a
diff --git a/backend/box/box.go b/backend/box/box.go
index 57e8d4f23..e932b0762 100644
--- a/backend/box/box.go
+++ b/backend/box/box.go
@@ -77,7 +77,7 @@ var (
)
type boxCustomClaims struct {
- jwt.RegisteredClaims
+ jwt.StandardClaims
BoxSubType string `json:"box_sub_type,omitempty"`
}
@@ -208,12 +208,14 @@ func getClaims(boxConfig *api.ConfigJSON, boxSubType string) (claims *boxCustomC
}
claims = &boxCustomClaims{
- RegisteredClaims: jwt.RegisteredClaims{
- ID: val,
+ //lint:ignore SA1019 since we need to use jwt.StandardClaims even if deprecated in jwt-go v4 until a more permanent solution is ready in time before jwt-go v5 where it is removed entirely
+ //nolint:staticcheck // Don't include staticcheck when running golangci-lint to avoid SA1019
+ StandardClaims: jwt.StandardClaims{
+ Id: val,
Issuer: boxConfig.BoxAppSettings.ClientID,
Subject: boxConfig.EnterpriseID,
- Audience: jwt.ClaimStrings{tokenURL},
- ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Second * 45)),
+ Audience: tokenURL,
+ ExpiresAt: time.Now().Add(time.Second * 45).Unix(),
},
BoxSubType: boxSubType,
}