Chris
Chris

Reputation: 33

Microsoft Store collection REST API, Create Azure AD access tokens returns 404

I'm following the Tutorial "Manage product entitlements from a service" here,

Am getting stuck on step 3, where calls to request an access token return a 404 error.

Step1: In Azure Portal,

Step2: In MS DevCenter

Added _APP_ID_ to "Services-> Product collections and purchases -> Client ID".

Step3: Testing using Postman

I pulled the Azure AD Tenant ID _TENANT_ID_ from the PortalDiagnostics.json. Using the provided sample, I used postman to post as follows:

POST https://login.microsoftonline.com/_TENANT_ID_/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8

grant_type=client_credentials
&client_id=_APP_ID_
&client_secret=_APP_SECRET_
&resource=https://onestore.microsoft.com

Host and content type are set in the headers, remainder is posted as raw text in the body.

POSTMAN with headers & body POSTMAN headers POSTMAN body

As you can see, the result is a 404 with no body, making this a little tough to trouble shoot.

Question:

  1. Have I missed something obvious in steps 1 & 2?
  2. Should I be able to test this with POSTMAN?

I'd appreciate any pointers; I can't find any other tutorials to cross reference.

Upvotes: 3

Views: 266

Answers (1)

juunas
juunas

Reputation: 58898

So in this case the problem was a rogue HTTP/1.1 at the end of the URL + some unencoded content in the form data. Using Postman's x-www-form-urlencoded tab helped for that since it encodes all the fields for you.

Upvotes: 2

Related Questions