diff --git a/components/skus/browser/rs/lib/src/sdk/credentials/fetch.rs b/components/skus/browser/rs/lib/src/sdk/credentials/fetch.rs index 37cf373decbc..8e2ed19c73ba 100644 --- a/components/skus/browser/rs/lib/src/sdk/credentials/fetch.rs +++ b/components/skus/browser/rs/lib/src/sdk/credentials/fetch.rs @@ -132,13 +132,6 @@ where let blinded_creds: Vec = match self.client.get_time_limited_v2_creds(&item.id).await? { Some(item_creds) => { - // overwrite our request id if creds are already present - request_id = match item_creds.request_id { - Some(request_id) => request_id, - // use the item id as the request id if it was not persisted - None => item_id.to_string(), - }; - // are we almost expired let almost_expired = self .last_matching_time_limited_v2_credential(&item.id) @@ -155,6 +148,14 @@ where match item_creds.state { CredentialState::GeneratedCredentials | CredentialState::SubmittedCredentials => { + // overwrite our request id if creds are already present + // that we need to resubmit + request_id = match item_creds.request_id { + Some(request_id) => request_id, + // use the item id as the request id if it was not persisted + None => item_id.to_string(), + }; + // we have generated, or performed submission, reuse the // creds we created for signing. creds diff --git a/components/skus/browser/rs/lib/src/storage/kv.rs b/components/skus/browser/rs/lib/src/storage/kv.rs index 566614f0088c..7e7b734a40e1 100644 --- a/components/skus/browser/rs/lib/src/storage/kv.rs +++ b/components/skus/browser/rs/lib/src/storage/kv.rs @@ -302,6 +302,7 @@ where // don't overwrite the existing unblinded_creds, we just want to add the new blinded // tokens to the item_credentials.creds for signing request if let Credentials::TimeLimitedV2(item_credentials) = item_credentials { + item_credentials.request_id = Some(request_id.to_string()); item_credentials.creds = creds; // update state to generated credentials item_credentials.state = CredentialState::GeneratedCredentials;