Git Product home page Git Product logo

microsoft-store-services's Introduction

Microsoft.StoreServices

Goals

Provide a library to help simplify the process for authenticating with and calling the Microsoft Store Services from your own back-end services. With these services you can verify and manage user purchases made for your app or game within the Microsoft Store (including Xbox consoles).

Store Services

This library specifically provides the functionality outlined in Manage product entitlements from a service.

Sample Service

A sample service that demonstrates how to use the Microsoft.StoreServices library as well as some logic around managing consumables and refunded items can be found in the following repo: https://github.com/microsoft/Microsoft-Store-Services-Sample

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Legal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

microsoft-store-services's People

Contributors

camerongoodwin avatar darkscott avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

microsoft-store-services's Issues

URL encode client secret


It'd be a good idea to URL encode the client secret here, since there is no limitation on what characters it may contain. I used one containing the % sign and ended up getting 401s.

URL encoding the secret solved it:

    var encodedSecret = System.Web.HttpUtility.UrlEncode(_clientSecret);
    var requestBody = $"grant_type=client_credentials&client_id={_clientId}" +
                                  $"&client_secret={encodedSecret}" +
                                  $"&resource={audience}";

Provide License Acquired Date

Instructions for implementing trial version of the app refers devs to ExpirationDate field, but this field returns year 9999 for free apps and unlimited trials. Time limited trials are very limited in options and very strict as they don't allow users to start the app at all.

In order to implement more flexible trial version, devs need the start date, but devs cannot easily establish when the user acquired the app. One can try to store something locally (unreliable, not multi device aware), or use a web service (expensive, complex, privacy issues).

Best solution is for store to expose "license acquired date".

This would free devs to have more flexible trial version solutions without adding cost or complexity. For example, have a free app with a month honeymoon period after which some features are blocked or nagging to pay starts.

Can you please add this?

This would fit well with "dev friendly store" win11 announcement!

https://docs.microsoft.com/en-us/windows/uwp/monetize/exclude-or-limit-features-in-a-trial-version-of-your-app#step-4-get-an-apps-trial-expiration-date

A few questions

I know this isn't a very specific issue, but it seems like this repository is in very early development, so I thought I list a few questions I have here.

  1. Will this be made into a NuGet package?
  2. Why are you using the old-style v1.0 Azure auth rather than the new v2.0 version?
  3. There are some differences between the parameters used here and documented here - https://docs.microsoft.com/en-us/windows/uwp/monetize/query-for-products. I notice you are using a 'v8.0' rather than v6.0. Is the v8.0 API documented anywhere?
  4. I couldn't find the equivalent of the purchaser property returned by the collections API in v6.0. Is there one? In particular, I am planning to make use of the identityValue field, because I am hoping that this is non-spoofable assuming that it is embedded into the user key on creation and properly signed, although I'm not 100% sure about this.
  5. Do you plan to make it easier to use access token caching for a service that is managing more than one app (i.e. could the access token cache optionally have a tenant Id and app Id as part of the cache key)?

Provide a publisher-specific Microsoft Store user ID

I appreciate that this is probably the wrong repository for this, and you are probably not in a position to act on this request, but here it is anyway.

It would be great if the StoreContext provided a way of getting a unique identifier for the user currently signed in to the Store. This should also be embedded in the Microsoft Store User ID token (which is signed) in a way that cannot be spoofed. This can be specific to the publisher, if if necessary specific to the app. I don't see why this would be a breach of privacy for the user if it was a publisher-specific ID. I am also fairly sure this is technically possible, although may be a bit of work.

The reason I want this is slightly long-winder, but I'm sure there are also simpler scenarios that would benefit. Basically, one advantage of using the Store for purchases is that the user does not have to sign in (because generally they are always signed in to their Microsoft account). Therefore it's nice to be able to manage things without requiring a sign-in.

In my case I am actually trying to do something that should be quite simple but is really very complicated. Basically I want to user to retain access to an addon they purchased through the Store even if they sign out of the Store. I am willing to assume that the the user cannot edit my app code or Windows code, but they can view my app code. Therefore what I want is to sign a license containing a device identifier (obtained usingSystemIdentification.GetSystemIdForPublisher) and addon identifier with a private key (not embedded in the app), which can be verified with a public key embedded in the app. Moreover, it's necessary to limit the number of devices per addon purchase to something like 10. It is actually surprisingly difficult to implement this seemingly common requirement (and in fact I think it should be made even easier than the improvement I am suggesting here). In order to do this it seems I have to use the Microsoft Store services API to get the addon entitlement on my server and then sign it for a device and send the license back to the client. I am using the transaction ID plus product SKU ID to identify the individual addon purchase for the purposes of limiting the licensed devices to 10, although not sure if that's best. Due to the lack of a user ID, I have to using the transaction ID as the 'owner'. This is quite awkward when it comes to allowing the user to delete a device license (in case they are no longer using that device), because in order to determine ownership I have to query for the user's licenses from the Store, then see if the transaction ID is contained in the result. A user ID would be of great help here.

AAD Access Tokens returned in v1.0 when v2.0 is requested. Can't use Certificate to request a token

Hi @CameronGoodwin,
Introduction
In the last 2 days I've been revising some todos that aren't done yet, and tried to ping @hickeys to get any conclusion regarding this issue. I do understand posting in Microsoft Docs is not the right spot to raise issues because this is a thing related to services and not the docs. Either way, in my opinion, some documentation look a quite draft here. So, to sort things out, I'm coming to you in hope you can help me understand/point me to the right direction.

Explanation
I'm trying to use Certificates instead of Secrets to request access tokens so the client can use them on getting the Store Id Key.
I'm getting 2 different tokens for collections and purchase endpoints but both are returned in a v1.0 format. I specifically set the manifest of my entity in App Registrations with the value: "accessTokenAcceptedVersion": 2

I came with this conclusion after raising this issue and this issue. Both are closed because this looks like to a service issue, and we may need warn several teams.

The endpoint https://collections.mp.microsoft.com/v7.0/beneficiaries/me/keys, which is used by the Windows SDK, requests the Store Id Key but returns an error when the request is made with token that was issued with a certificate. That token contains the value appidacr=2, i checked myself before publishing here. Also, appidacr is claim from v1.0. This endpoint requires the use of appidacr=1. This claim is a requirement for v1.0 tokens.

Access Token returned by AAD
InkedScreenshot 2021-12-10 211156

Endpoint used by the Windows SDK to get the Store Id Key
PedidoEfetuadoComCertificateInvesSecretPeloWindowsSDKParaObterStoreIdKey

My insights

I took a look on your code, and this code snippet shows you are following the doc.
image
var requestUri = $"https://login.microsoftonline.com/{_tenantId}/oauth2/v2.0/token"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, requestUri.ToString()); var requestBody = $"grant_type=client_credentials&client_id={_clientId}" + $"&client_secret={encodedSecret}" + $"&scope={audience}/.default";

Sorry for the long post, and links... but can you help me out/comment/alert the teams if this is an issue?

Can't download Store, no Store available on OS

I am trying to do a very basic thing: Use Microsoft Store. And I can't. This is unbelievably frustrating.

image

The download link points to a confirmation PDF. Can we get this fixed please? I don't want to use the online store, I want to use the app itself, which is strangely missing, as ubiquitous and intrusive as it normally is. Sigh.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.