Secure Application Model
Learn and ask questions on how to implement secure application model

Don't see your topic? Start a Topic
Reply
Level 1 Contributor

Partner Portal REST Authentication?

Hello!

I'm a bit new to the partner portal REST interface so I might be missing something, but I'm able to generate an access token, but any subsequent calls fail due to 401?  I'm assuming that if I was able to generate a token I should be able to interact with these resources?  The current authentication instructions seem to indicate that this should work, but it looks like there may have been some changes?

POST /v1/validations/address HTTP/1.1
Host: api.partnercenter.microsoft.com
Authorization: Bearer token
Content-Type: application/json
MS-Contract-Version: v1
MS-RequestId: 2ed90876-94d7-451f-a7e8-f3f7cdf932b5
MS-CorrelationId: 3eb8b7f7-9b0f-4c75-8d55-b1d17565b6cb
X-Locale: en-US
Cache-Control: no-cache
Postman-Token: 5d2ae072-2d10-ca30-8f33-587942f3bcfd

{
AddressLine1: "One Microsoft Way",
City: "Redmond",
State: "WA",
PostalCode: "98052",
Country: "US"
}

Level 1 Contributor

Re: Partner Portal REST Authentication?

What endpoints are you using to aquire tokens? and have you shiftet to the new "secure app model"? you are posting in that section, but since you ask if theres a change, thought I should ask

Highlighted
Level 1 Contributor

Re: Partner Portal REST Authentication?

Hi,

Migrating to the new secureapp model  for the app  with partnercenter access (Using /oauth2/token not oauth2/v2.0/token)

- Using the Token obtained with AppID AppSecret I can call https://api.partnercenter.microsoft.com/generatetoken providing my graph token  and I get a token that works to read customer info

- Using the Token obtained using the refreshToken obtained following and Authorize and providing Consent for the same App  -  I get a an 401 Unauthorized

1) I noted that token obtained with the endpoint oauth2/v2.0 are invalid to https://api.partnercenter.microsoft.com/generatetoken

2) Token content are similar as far of roles

3) scope used was:scope=https://api.partnercenter.microsoft.com/.default&offline_access%20Device.ReadWrite.All%20Directory.Read.All%20Directory.AccessAsUser.All%20Directory.ReadWrite.All%20User.Read%20User.Read.All%20User.ReadBasic.All

 

Thanks

 

Microsoft

Re: Partner Portal REST Authentication?

Hi @pierre_lestage,

Use of the GenerateToken request has been deprecated, it is recommended that you update your code to not perform that operation. Also, through my experience I have better results using the Azure AD v1 endpoints because of compatibility issues with things like pre-consent. The Partner Center Authentication documentation should guide you through this. Please let us know if you have any concerns or questions.

Isaiah Williams
Cloud Technology Strategist | US – One Commercial Partner