You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: uwp/monetize/renew-a-windows-store-id-key.md
+14-16Lines changed: 14 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,31 @@
2
2
ms.assetid: 3569C505-8D8C-4D85-B383-4839F13B2466
3
3
description: Learn how to renew an expired Microsoft Store ID key using the renew method in the Microsoft Store collection and purchase APIs.
4
4
title: Renew a Microsoft Store ID key
5
-
ms.date: 04/22/2021
5
+
ms.date: 12/06/2024
6
6
ms.topic: article
7
7
keywords: windows 10, uwp, Microsoft Store collection API, Microsoft Store purchase API, Microsoft Store ID key, renew
8
8
ms.localizationpriority: medium
9
9
---
10
10
# Renew a Microsoft Store ID key
11
11
12
-
13
-
Use this method to renew a Microsoft Store key. When you [generate a Microsoft Store ID key](view-and-grant-products-from-a-service.md#step-4), the key is valid for 90 days. After the key expires, you can use the expired key to renegotiate a new key by using this method.
12
+
Use this method to renew a Microsoft Store key. When you [generate a Microsoft Store ID key](view-and-grant-products-from-a-service.md#step-4), the key is valid for 30 days. Before the key expires, you can use it to renegotiate a new key by using this method.
14
13
15
14
The [Microsoft.StoreServices library](https://github.com/microsoft/Microsoft-Store-Services) provides the functionality of this method through the UserStoreId.RefreshStoreId API.
16
15
16
+
> [!NOTE]
17
+
> Previously Microsoft Store keys had a longer lifetime and in some cases were able to be renewed after the key had already expired.
18
+
> Now, developers should only expect keys to be renewable during their lifetime and should note the expire date on the keys in order to renew them before they expire.
17
19
18
-
## Prerequisites
20
+
> [!IMPORTANT]
21
+
> Although Microsoft Store keys are able to be renewed before they expire, the keys may be revoked prior to their expire dates in response to security concerns.
22
+
> Therefore, your services should handle the case where a renewal attempt fails with the AuthenticationTokenInvalid.
23
+
> In this case, you should generate a new Microsoft Store key for the user on the client or the method used to generate the original Microsoft Store key.
19
24
25
+
## Prerequisites
20
26
21
27
To use this method, you will need:
22
28
23
-
* An Azure AD access token that has the audience URI value `https://onestore.microsoft.com`.
29
+
* An Entra ID access token that has the audience URI value `https://onestore.microsoft.com/.default`.
24
30
* An expired Microsoft Store ID key that was [generated from client-side code in your app](view-and-grant-products-from-a-service.md#step-4).
25
31
26
32
For more information, see [Manage product entitlements from a service](view-and-grant-products-from-a-service.md).
@@ -34,7 +40,6 @@ For more information, see [Manage product entitlements from a service](view-and-
34
40
| Collections | POST |```https://collections.mp.microsoft.com/v6.0/b2b/keys/renew```|
35
41
| Purchase | POST |```https://purchase.mp.microsoft.com/v6.0/b2b/keys/renew```|
36
42
37
-
38
43
### Request header
39
44
40
45
| Header | Type | Description |
@@ -43,15 +48,13 @@ For more information, see [Manage product entitlements from a service](view-and-
43
48
| Content-Length | number | The length of the request body. |
44
49
| Content-Type | string | Specifies the request and response type. Currently, the only supported value is **application/json**. |
| 401 | Unauthorized | AuthenticationTokenInvalid | The Azure AD access token is invalid. In some cases the details of the ServiceError will contain more information, such as when the token is expired or the *appid* claim is missing. |
102
-
| 401 | Unauthorized | InconsistentClientId | The *clientId* claim in the Microsoft Store ID key and the *appid* claim in the Azure AD access token do not match. |
103
-
101
+
| 401 | Unauthorized | AuthenticationTokenInvalid | The Entra ID access token or the Microsoft Store Key being renewed are invalid. In some cases the details of the ServiceError will contain more information, such as when the token is expired or the *appid* claim is missing. |
102
+
| 401 | Unauthorized | InconsistentClientId | The *clientId* claim in the Microsoft Store ID key and the *appid* claim in the Entra ID access token do not match. |
104
103
105
104
## Related topics
106
105
107
-
108
106
*[Manage product entitlements from a service](view-and-grant-products-from-a-service.md)
109
107
*[Query for products](query-for-products.md)
110
108
*[Report consumable products as fulfilled](report-consumable-products-as-fulfilled.md)
0 commit comments