mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
fix: store the VPP token encoded (#20606)
> Related issue: part of #20229 # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Manual QA for all new/changed functionality
This commit is contained in:
parent
caa7fd74e4
commit
b35724bd30
2 changed files with 8 additions and 9 deletions
|
|
@ -2,7 +2,6 @@ package service
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
|
@ -25,7 +24,7 @@ func (svc *Service) getVPPToken(ctx context.Context) (string, error) {
|
|||
return "", ctxerr.Wrap(ctx, err, "unmarshaling VPP token data")
|
||||
}
|
||||
|
||||
return base64.StdEncoding.EncodeToString([]byte(vppTokenData.Token)), nil
|
||||
return vppTokenData.Token, nil
|
||||
}
|
||||
|
||||
func (svc *Service) GetAppStoreApps(ctx context.Context, teamID *uint) ([]*fleet.VPPApp, error) {
|
||||
|
|
|
|||
|
|
@ -2624,13 +2624,8 @@ func (svc *Service) UploadMDMAppleVPPToken(ctx context.Context, token io.ReadSee
|
|||
return ctxerr.Wrap(ctx, err, "validating VPP token with Apple")
|
||||
}
|
||||
|
||||
decodedTokenBytes, err := base64.StdEncoding.DecodeString(string(tokenBytes))
|
||||
if err != nil {
|
||||
return ctxerr.Wrap(ctx, err, "decoding VPP token")
|
||||
}
|
||||
|
||||
data := fleet.VPPTokenData{
|
||||
Token: string(decodedTokenBytes),
|
||||
Token: string(tokenBytes),
|
||||
Location: locName,
|
||||
}
|
||||
|
||||
|
|
@ -2694,7 +2689,12 @@ func (svc *Service) GetMDMAppleVPPToken(ctx context.Context) (*fleet.VPPTokenInf
|
|||
}
|
||||
|
||||
var rawToken fleet.VPPTokenRaw
|
||||
if err := json.Unmarshal([]byte(tokenData.Token), &rawToken); err != nil {
|
||||
decodedBytes, err := base64.StdEncoding.DecodeString(tokenData.Token)
|
||||
if err != nil {
|
||||
return nil, ctxerr.Wrap(ctx, err, "decoding VPP token")
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(decodedBytes, &rawToken); err != nil {
|
||||
return nil, ctxerr.Wrap(ctx, err, "unmarshaling VPP token")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue