How do I fix the 401 Invalid authorization bearer is passed (invalid_grant) error when attempting to do a REST call to https://api.partnercenter.microsoft.com/v1/offers?country=US

PaulRusso-8946 45 Reputation points
2023-08-10T19:26:17.31+00:00

I followed these instructions to get a access_token to make a REST call to the offers api in partnercenter.

{
    "token_type": "Bearer",
    "expires_in": "3599",
    "ext_expires_in": "3599",
    "expires_on": "1691697809",
    "not_before": "1691693909",
    "resource": "https://graph.windows.net",
    "access_token":"***"
}

I set the Authorization and Accept headers to make a GET request to https://api.partnercenter.microsoft.com/v1/offers?country=US

following these instructions

What returns is 401 Invalid authorization bearer is passed (invalid_grant)

Is the resource correct in the JSON above to make that call?

What else should I check?

Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
344 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Giovanni Toraldo 6 Reputation points
    2023-08-30T13:55:44.6266667+00:00

    Same issue here.

    It just stopped working from today.

    I retrieve the access token from azure https://login.microsoftonline.com/cloudesireeng.onmicrosoft.com/oauth2/v2.0/token client_info=1 grant_type=client_credentials scope="openid profile offline_access https://graph.microsoft.com/.default" client_secret="SECRET" client_id=CLIENT_ID Content-Type:"application/x-www-form-urlencoded; charset=UTF-8"

    and the I use the Bearer to retrieve the customers from partner center, it worked until yesterday, from today is says: 401 (invalid_grant)


  2. Tord Glad Nordahl 0 Reputation points
    2023-10-02T09:36:24.6533333+00:00

    I got the same problem, just recently it stopped working and is now giving me a 401. I thought it might have occurred due to a Partner Center ID merge, but it seems like it's a current bug as the token is received with the right permissions. I have created a ticket to MS to look into the problem.


  3. Jignesh Patel 0 Reputation points
    2024-02-19T16:32:03.2433333+00:00

    We started getting the invalid_grant error starting from 15th Feb 2024 for Government partner center SDK & REST API, not getting enough support from microsoft/Azure/partnercenter. Has anyone seen the same issue or have any solution?

    0 comments No comments

  4. Miroslav Karpíšek 0 Reputation points
    2024-07-22T13:07:55.1133333+00:00

    Facing the same issue... anyone managed to fix it? Thank you

    0 comments No comments

  5. Chris Hansen 0 Reputation points
    2024-08-14T14:16:13.2733333+00:00

    Same issue here as well

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.